|
From: | Riccardo Mottola |
Subject: | Re: NSMutableString -initWithFormat appends to existing text |
Date: | Wed, 18 Apr 2018 17:28:09 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.1 |
Hi, Mick Bert wrote:
What do you mean by "write the stream directly"?
you dump the whole string directly to a path. Easy and fast!
Otherwise indeed, work with NSFileHandle https://www.gnu.org/software/gnustep/resources/documentation/Developer/Base/Reference/NSFileHandle.htmlHow about reading per-line? Have I to read a chunk of file, and look by myself for the line terminator? Aren't there something like the std::getline() of c++?
As far as I know, no. you can read per character, per bytes, by sized chunks. But not per dat. You could write an extension yourself if needed.
However, a very quick way is to slurp the whole file in a string and split in an NSArray with -componentsSeparatedByString:
I have used that with files of GBytes, provided your system has memory.My suggestion is to try to use that and start writing your program and then optimize later, if you don't know already that you need to work on extremely big files that you can handle.
Riccardo
[Prev in Thread] | Current Thread | [Next in Thread] |