Tiger Decoding problem
Tiger Decoding problem
- Subject: Tiger Decoding problem
- From: Nicholas Crosbie <email@hidden>
- Date: Mon, 30 May 2005 10:24:59 +1000 (EST)
Hi,
Newbie problems. I'm trying to read in and convert
binary
data. The (new in Tiger) appropriate code seems to be
either......
+ (id)stringWithContentsOfFile:(NSString *)path
encoding:(NSStringEncoding)enc error:(NSError **)error
OR
+ (id)stringWithContentsOfFile:(NSString *)path
usedEncoding:(NSStringEncoding *)enc error:(NSError
**)error
I've tried to test these function in a Foundation Tool
project.
What's wrong with my code (see below)?
Building always fails at the NSString *contents line.
Do I have to initialize an
NSError object? Help with the correct syntax would be
much appreciated. Note that I'm not
building a new class....just trying to test
stringWithContentsOfFile........
// DECODE TO HUMAN READABLE FORM
#import <Cocoa/Cocoa.h>
int main (int argc, char *argv[])
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSString *path = [NSString new];
path = @"/Users/nicholas/test2/fileB";
NSString *contents = [NSString
stringWithContentsOfFile:path NSStringEncoding
encoding:NSUTF8StringEncoding];
NSLog(@"contents %@",contents);
[pool release];
return 0;
}
Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden