/*
1.文件路径
2.对文件的操作
“w” write 写
“r” read 读
“a” append 追加
*/
FILE *file = fopen("/Users/hanMac/Desktop/han.txt", "w");
NSString *str = @"Han 好帅呀";
const char *tempChar = [str UTF8String];
fputs(tempChar, file);
fclose(file);
FILE *file2 = fopen("/Users/hanMac/Desktop/han.txt", "r");
char tempC[1024];
fgets(tempC, 1024, file);
NSString *str2 = [NSString stringWithUTF8String:tempC];
fclose(file2);
网友评论