Re: Text file
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>) |