Is there anyway to get more detailed error data back from “createFileAtPath” I was kind of expecting an NSError? Currently I am using the BOOL return value.
success = [fileMan createFileAtPath:fileOnDisk contents:dBuffer attributes:nil];
if(success == YES) NSLog(@"FileCreated");
else {
NSLog(@"ERROR: Failed to create file");
return 1;
}
gary
I agree… I’d love to have a function for this that accepts NSError!
Errors returned in this case are usually one of the POSIX errors declared in
errno.h(errnois automatically included for you as part of the Cocoa or Foundation headers).To see the error, use the
strerrorfunction fromerrno.hand reference the globalerrnointeger, which is set by the low-level POSIX io functions when a problem occurs:The list of error code constants are listed in the in the Error Handling Programming Guide for Cocoa (in addition to the errno.h header itself).