문제

How can I format a pen drive programmatically with particular disc type like fat, exFat, NTFS etc. I am trying in cocoa, please help.

도움이 되었습니까?

해결책 2

Its with NSTask.

NSTask *task = [NSTask new];
[task setLaunchPath:@"/usr/bin/env"];
[task setArguments:[NSArray arrayWithObjects:@"diskutil", @"eraseVolume", @"ms-dos", nmToPD, pathToPD,nil]];

NSPipe *pipe = [NSPipe pipe];
[task setStandardOutput:pipe];
[task launch];
[task waitUntilExit];

다른 팁

Take a look at NSFileManager Class Reference

- (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error  

or

You can use diskutil command with eraseDisk option

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top