我用Xcode编写了这段代码来从文件中读取:
int main (int argc, char *argv[])
{
FILE *fp = fopen("hello.rtf", "r");
printf("%c\n", fgetc(fp));
fclose(fp);
if (fp == NULL)
{
printf("Could not open file!");
return 1;
}
// insert code here...
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我得到的字符是"{",它不是文件中的第一个字符.
c ×1