Hi,

I'm trying to read a file using this code, which is failing:


        NSStringEncoding *enc;
        NSError *error;
        
NSString *file = [NSString stringWithContentsOfFile:@"/Users/colin/ developer/Trace/glass.csv" usedEncoding:enc error:&error];
        
        NSLog(@"%i:   %@", [error code], [error userInfo]);


The log shows:


2009-10-02 05:23:16.788 Trace[40156:a0f] 264:   {
    NSFilePath = "/Users/colin/developer/Trace/glass.csv";
}


Only when I do

(gdb) po error

do I get


Error Domain=NSCocoaErrorDomain Code=264 UserInfo=0x2000506e0 "The file “glass” couldn’t be opened because the text encoding of its contents can’t be determined."


which is much more helpful!


Why is my NSLog statement being so unhelpful???


--colin_______________________________________________

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