Filesystem - Testing FS Type


/ Published in: Objective C
Save to your folder(s)

This can be used to test FS type.


Copy this code and paste it in your HTML
  1. int main (int argc, const char * argv[]) {
  2. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  3.  
  4. struct statfs fsInfo;
  5.  
  6. NSLog(@"Testing %s", argv[1]);
  7. if (statfs(argv[1], &fsInfo) == -1) {
  8. NSLog(@"Error %s", argv[1]);
  9. exit(1);
  10. }
  11.  
  12. if (fsInfo.f_flags & MNT_RDONLY) {
  13. NSLog(@"Read only %s", argv[1]);
  14. exit(0);
  15. }
  16.  
  17. NSLog(@"Type %s", fsInfo.f_fstypename);
  18.  
  19. [pool release];
  20. return 0;
  21. }

URL: http://www.cocoabuilder.com/archive/message/cocoa/2006/5/18/163842

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.