• 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: Read lines from very large text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Read lines from very large text file


  • Subject: Re: Read lines from very large text file
  • From: Jacob Rhoden <email@hidden>
  • Date: Tue, 03 Feb 2009 13:38:50 +1100

On 3/02/2009 8:41 AM, Kenneth Bruno II wrote:
I am wondering what the best way to read a text file, line by line, when the file size is much larger than available memory.
For very large files you probably want to use NSFileHandle. With the method readDataOfLength: you can read the file in chunks and then parse through for the line endings.

I also find the non existence of a readLine type mechanism quite strange. Either way, this has given me enough to go on so thanks for the help!


I can just read in large blocks, read each line within the large block, then use the index of the last line ending to fetch the next large block.

Sounds like a worthwhile blog entry (:

Best regards,
Jacob
_______________________________________________

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


  • Follow-Ups:
    • Re: Read lines from very large text file
      • From: Steve Sisak <email@hidden>
References: 
 >Read lines from very large text file (From: Jacob Rhoden <email@hidden>)
 >Re: Read lines from very large text file (From: Kenneth Bruno II <email@hidden>)

  • Prev by Date: Re: Read lines from very large text file
  • Next by Date: Re: becomeFirstResponder override issue
  • Previous by thread: Re: Read lines from very large text file
  • Next by thread: Re: Read lines from very large text file
  • Index(es):
    • Date
    • Thread