• 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 text files line-by-line (dead link from archive)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading text files line-by-line (dead link from archive)


  • Subject: Re: Reading text files line-by-line (dead link from archive)
  • From: "Daniel Dickison" <email@hidden>
  • Date: Wed, 29 Aug 2007 07:57:07 -0400

On 8/28/07, Oleg Kibirev <email@hidden> wrote:
> You can just use plain old fdopen and fgets if your lines are of a
> reasonable size. Otherwise you can mmap a few megs of the file at a
> time and use memchr(ptr, '\n', len) to look for newlines in the
> mapped area.
>

I think fdopen and fgets will work.  Fortunately I don't need to read
in classic Mac OS text files (with '\r' EOLs) which I presume would
not work with fgets.

I haven't worked too much with plain C so I wasn't familiar with these
functions.  Thanks for the tip!

Daniel
_______________________________________________

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

References: 
 >Reading text files line-by-line (dead link from archive) (From: Daniel Dickison <email@hidden>)
 >Re: Reading text files line-by-line (dead link from archive) (From: Scott Thompson <email@hidden>)
 >Re: Reading text files line-by-line (dead link from archive) (From: Daniel Dickison <email@hidden>)
 >Re: Reading text files line-by-line (dead link from archive) (From: Oleg Kibirev <email@hidden>)

  • Prev by Date: Re: encoding vended objects
  • Next by Date: radio buttons in NSMatrix obscuring text field
  • Previous by thread: Re: Reading text files line-by-line (dead link from archive)
  • Next by thread: NSXMLDocument freezes UI
  • Index(es):
    • Date
    • Thread