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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to