obj-c 读取文件 。
-(void)redfile { FILE *fp=fopen([[self bundlePath:@"information.txt"]UTF8String], "r"); char word[100]; if (!fp) { return; } while(fgets(word, 100,fp)) { word[strlen(word)-1] = '\0'; NSLog(@"%s",word); } fclose(fp); } //读取同目录下文件路jin -(NSString *)bundlePath:(NSString *)fileName { return [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:fileName]; }