• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie, Q about files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Newbie, Q about files (From: email@hidden (Henri Hansen))

  • Prev by Date: Re: Dynamically connecting IBOutlet
  • Next by Date: Re: Info window scenario
  • Previous by thread: Newbie, Q about files
  • Next by thread: Bug in setKeyEquivalentMask:?
  • Index(es):
    • Date
    • Thread