reading several lines
reading several lines
- Subject: reading several lines
- From: Hans van der Meer <email@hidden>
- Date: Thu, 11 Oct 2007 23:24:39 +0200
I need to read a file containing lines of text. Like this:
abcd
efg
xyz
After some searching of the docs I came up with:
NSString *contents =
[NSString stringWithContentsOfFile: file encoding:
NSASCIIStringEncoding error: NULL];
However, this does not seem to read beyond the first line, giving
contents = "abcd" and nothing more.
Repeated calling makes no difference, as could be expected. Changing
the end of lines to Apple's and the encoding to the MacRoman encoding
had no effect.
How do I either repeatedly read the lines? Or all of them at once and
scanning the resulting string? Because the text file can become
fairly long, the first option could be desirable.
The "String Programming Guide for Cocoa" did not help me further.
Can someone point me in the right direction?
Hans van der Meer
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden