Re: Newbie, Q about files
Re: Newbie, Q about files
- Subject: Re: Newbie, Q about files
- From: "e.sammer" <email@hidden>
- Date: Tue, 06 Nov 2001 18:53:22 -0500
Henri Hansen wrote:
The problem I have is not to select the file to analyze, but
how to habdle the file afterwards. Because the file might be
much larger than 100MB I'd like to read the file in line by
line. This is quite easy in RealBasic where you create a
TextStream and then you can read the file line by line, but
I have no idea how to do this Cocoa. The same problem ocures,
for the output of my analyzer Programs, because I need to write
different informations to different files. Again, this is no
problem in RB, you only have to create the different files
(whithout asking the user) and then I can write my output
line by line to these files.
it sounds like what you're looking for is
NSFileHandle. you can use:
+ fileHandleForReadingAtPath:@"/path/to/file"
to create an NSFileHandle object and make calls to
- readDataOfLength: to read the file in chunks
rather then the entire file at once. for more
info, check out:
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSFileHandle.html
hope this helps...
--
e.sammer
email@hidden