Re: Reading one line at a time using NSFileHandle



On Mar 26, 2009, at 4:48 PM, Erg Consultant wrote:

Problem with using NSString is that when it comes time to write the line out to the new file, I need an NSData and to create one, I have to use NSString's getBytes or getCharacters.

No, you should use -[NSString dataUsingEncoding:].

If you just want to create/replace a whole file from a string, use - [NSString writeToFile:atomically:encoding:error:].

Either way, you get to (have to) specify the encoding.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/maillists%40codeha.us

This email sent to maillists@xxxxxxxxx

...



Privacy