Reading text file with NSString:stringWithContentsOfFile?

Viewed 17369

Reading text file with NSString:stringWithContentsOfFile?

NSString *txtFilePath = [[NSBundle mainBundle] pathForResource:@"\help" ofType:@"txt"];
NSString *txtFileContents = [NSString stringWithContentsOfFile:txtFilePath encoding:NSUTF8StringEncoding error:NULL];

NSLog(@"File:  %@",txtFileContents);

I get "null" as the result. How do I know what path to specify?

thanks

(I placed the file just under "Groups and Files" ... so not sure if I need to specify a path or just the file name. Maybe there is something else wrong ???

3 Answers
Related