• 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: Reading one line at a time using NSFileHandle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Reading one line at a time using NSFileHandle


  • Subject: RE: Reading one line at a time using NSFileHandle
  • From: "Jeff Laing" <email@hidden>
  • Date: Wed, 25 Mar 2009 21:44:01 -0600
  • Thread-topic: Reading one line at a time using NSFileHandle

>> Is there a way to read one line of a text file at a time
>> using NSFileHandle (the way fgets does)?
>
> This code illustrates how you might approach
> filtering lines of data obtained through an NSFileHandle.

I've come across this problem as well - its fine to say "read it all
into memory, then split it into lines seperated by my arbitrary
delimiter", but that doesn't work in small-memory environments (like the
iPhone) for big files which would otherwise be fine to parse line by
line.

Answers of the form "...but how do you know what the delimiter character
is, Unicode, blah blah" aren't all that helpful.  Lets assume that when
someone says fgets() they *know* that they want to access an 8-bit
ascii, newline-delimited text file line by line.

So far, the only answer I've ever seen is to fall back on
fopen()/fgets()
_______________________________________________

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: Reading one line at a time using NSFileHandle
      • From: Michael Ash <email@hidden>
References: 
 >Re: Reading one line at a time using NSFileHandle (From: Joel Norvell <email@hidden>)

  • Prev by Date: Re: Reading one line at a time using NSFileHandle
  • Next by Date: Re: Sorting through .plist in NSDictionary
  • Previous by thread: Re: Reading one line at a time using NSFileHandle
  • Next by thread: Re: Reading one line at a time using NSFileHandle
  • Index(es):
    • Date
    • Thread