void readFile(void) {
FILE *file;
int i;
char line[100];
int testnr, testnr2, testnr3, testnr4;
//testnr = 1;
//testnr2 = 2;
//testnr3 = 3;
//testnr4 = 4;
file = fopen("test.txt","r");
fgets(line,500,file); // does not do anything with the first line
// read in 1,2,3,4
fscanf(file, "%i %i %i %i", &testnr, &testnr2, &testnr3, &testnr4);
printf("%i %i %i %i \n", testnr, testnr2, testnr3, testnr4);
fclose(file);
}
终端中的输出变为:1 32714 -275292160 32767
我该如何解决它,所以它是:1 2 3 4
?