FILE* file_pointer = fopen("./text_file.txt", "r");
char name[255];
int age;
int salary;
fscanf(file_pointer, "%s %d %d\n", name, &age, &salary);
printf("%s %d %d\n", name, age, salary);
fscanf(file_pointer, "%s %d %d\n", name, &age, &salary);
printf("%s %d %d\n", name, age, salary);
现在有一个 text file text_file.txt 文件 :
Greg 23 40000
Julie 32 80000
程序应该打印出 Greg 23 40000 Julie 32 80000,这是为什么呢?