On Feb 2, 2009, at 9:29 PM, Peter Duniho wrote:

On Feb 2, 2009, at 6:02 PM, Seth Willits wrote:

Before opening the file, either determine, guess, or be told what the encoding is. With that encoding, convert your delimiter string into raw bytes, then do byte-for-byte comparison on the file to find occurrences of that delimiter.

Is there not a Cocoa class that handles character encoding and line- based reading from files, streams, etc.? And an equivalent one for writing?

That seems like an odd omission for a comprehensive framework.

NSString handles such things, the only thing I'm not sure is how it will handle a truly large multi-gigabyte text file (not that anyone is likely to have such a beast). With a gigantic file like that you'd probably have to switch to using something like NSFileHandle, read chunks, and then parse those chunks. However, I'd expect NSString to be handle reasonably large files in a sane manner.

As far as string manipulation, I'd take a look at the information straight from the horse's mouth: <http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/introStrings.html >

There are sections dedicated to reading strings from files and paragraphs and line breaks.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to