• 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: Text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text file


  • Subject: Re: Text file
  • From: Bill Bumgarner <email@hidden>
  • Date: Thu, 15 Apr 2010 09:41:14 -0700

On Apr 15, 2010, at 8:50 AM, Henrietta Read wrote:

> What's the correct way to open a text file? I'm using:
>
>   NSError *error = nil;
>   NSStringEncoding encoding;
>
>   [myMutableString setString:[NSString stringWithContentsOfFile:filePath
> usedEncoding:&encoding error:&error]];
>
> but on some files (say, Western Mac OS Roman) it crashes.

>assembly deleted<

First, I'd suggest you post the backtrace of the crash, not the assembly.  Trying to debug a crash by looking at the assembly at the crash site is typically a method of near-last resort.

Given zero context, the above lines of code look fine.   Context needed to deduce this farther would be things like how filePath is initialized, how myMutableString was created, and the actual backtrace of the crash (and any other diagnostic messages, including whether or not you took a pass after "build and analyze" and fixed any problems it identified).

b.bum

_______________________________________________

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: 
 >Text file (From: Henrietta Read <email@hidden>)

  • Prev by Date: Re: Text file
  • Next by Date: Re: Text file
  • Previous by thread: Re: Text file
  • Next by thread: Re: Text file
  • Index(es):
    • Date
    • Thread