Re: writing huge C-array to a file
Re: writing huge C-array to a file
- Subject: Re: writing huge C-array to a file
- From: PGM <email@hidden>
- Date: Sun, 23 Jul 2006 22:40:51 -0400
Thanks for your suggestions. I had already looked into the
documentation of NSFileHandle and NSFileManager, but not being familiar
with fileDescriptors, I did not see any obvious way to do standard C
fprintf writing with the help of those classes.
For the archives, I now use the following code in NSDocument's
"writeToFile:ofType:":
//create new file if it does not yet exist
if(![[NSFileManager defaultManager] fileExistsAtPath:fileName]){
[[NSFileManager defaultManager] createFileAtPath:fileName
contents:[NSData data] attributes:nil];
}
FILE *writing;
NSFileHandle *handle = [NSFileHandle
fileHandleForUpdatingAtPath:fileName];
int descriptor = [handle fileDescriptor];
writing = fdopen(descriptor, "w");
//Now use fprintf for all the writing
fclose(writing);
[handle closeFile];
Best, Patrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden