Re: appending text to files
Re: appending text to files
- Subject: Re: appending text to files
- From: Markus Hitter <email@hidden>
- Date: Sun, 20 Nov 2005 00:25:16 +0100
Am 19.11.2005 um 22:32 schrieb Robert Dell:
i need to append a NSMutableString to a file that already exists.
is there any built-in method to do this?
i currently have this [...]
Is this actually failing? Or are you in seek of better performance?
One thing is, you don't have to read the file every time. It's
sufficient to read it once at app startup, then write it as data
changes. Unless you have multiple apps with simultanuouos (hello,
spell checker?) write access, of course.
Another approach would be go to the roots of Obj-C, to C. A sequence
of fopen(), fseek() and NSStrings's -dataUsingEncoding: in
combination with fwrite() should do it. Don't forget fclose(), of
course.
Third approach coming to mind would be to map the file into memory
with NS(Mutable)Data's +dataWithContentsOfMappedFile, then append the
string as data and release the NSData object.
The choice is your's.
Markus
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden