Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save doyle/133370 to your computer and use it in GitHub Desktop.
Save doyle/133370 to your computer and use it in GitHub Desktop.
Including files with your iPhone add + loading text files
//This sample loads a text file which is included with your iPhone application and sends the text to
// standard error
//
// This sample assumes you have added a file named "sometext.txt" to your "Resources" folder in your project.
-(NSString *)getFileLocation
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *filePath = [bundle pathForResource:@"sometext" ofType:@"txt"];
return filePath;
}
-(void)loadText{
NSString *file;
file = [NSString stringWithContentsOfFile:[self getFileLocation]];
NSLog(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment