Re: reading in text files
Re: reading in text files
- Subject: Re: reading in text files
- From: "Jonathan W. Hendry" <email@hidden>
- Date: Thu, 31 Jan 2002 20:00:49 -0600
"Charles Srstka" <email@hidden> wrote:
>
On Thursday, January 31, 2002, at 05:36 PM, Ben Mackin wrote:
>
>
> myFile is large (can be up to 16000 bytes), so I don't think reading the
>
> whole thing into an NSString would be good.
>
>
I read files that can be up to almost a megabyte in size into an
>
NSString and then do a componentsSeparatedByString: on them, without too
>
much of a performance problem.
Also:
"Then the first call to myFile >> string would leave string
with 'Hi', and then the next time I call myFile >> string,
string would contain 'a324', and etc."
Does it hit the disk file each time, or is the stream
buffered? If it's not buffered, this would be really
inefficient. It'd be more efficient to hit the disk once
to read the file into an NSString, then break the NSString
up into components.