• 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: Michael Ash <email@hidden>
  • Date: Sat, 7 Feb 2009 22:13:56 -0500

On Sat, Feb 7, 2009 at 12:46 PM, Joar Wingfors <email@hidden> wrote:
>
> On Feb 7, 2009, at 6:55 AM, Steve Sisak wrote:
>
>> Umm, unless I'm totally missing something, what's wrong with fopen() and
>> fgets(), possibly followed with [NSString stringWithCString] on each line?
>
>
> What's wrong is that they won't allow you to specify the text encoding to
> use. The same thing is true for the *deprecated* method
> "+stringWithCString:" by the way.

That is incorrect. What they don't do is care about encoding at all.
They treat the input stream as an opaque bag of bytes, aside from
looking for the line-ending characters. This means that it is almost
completely encoding agnostic, and will work for the vast majority of
text encodings.

This is not at all the same thing as +stringWithCString:. That one
tries to convert the given string to Unicode. That means that if it
uses the incorrect encoding, it produces the *wrong* result.

There's a substantial difference between simply passing data through
unconverted and attempting to convert it but getting the conversion
wrong.

Mike
_______________________________________________

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: Joar Wingfors <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>)
 >Re: Read lines from very large text file (From: Jacob Rhoden <email@hidden>)
 >Re: Read lines from very large text file (From: Joar Wingfors <email@hidden>)

  • Prev by Date: Re: performSelector:withObject fails with class object
  • Next by Date: Re: Animated toolbar
  • 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