Created
June 21, 2009 02:59
-
-
Save doyle/133370 to your computer and use it in GitHub Desktop.
Including files with your iPhone add + loading text files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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