N
nick
the following code is used to read a file called "input.txt"
# include <stdio.h>
int main(int argc,char *argv[]){
FILE *fp;
int ch;
fp=fopen("input.txt","r");
ch=fscanf(fp,"%d",&ch);
printf("%d\n",ch);
fclose(fp);
return 0;
}
the contains in "input.txt"
3
3 14
2 8
-1 0
when i run the program the output is:
1
what's going on?
why the output is not 3?
Nick
# include <stdio.h>
int main(int argc,char *argv[]){
FILE *fp;
int ch;
fp=fopen("input.txt","r");
ch=fscanf(fp,"%d",&ch);
printf("%d\n",ch);
fclose(fp);
return 0;
}
the contains in "input.txt"
3
3 14
2 8
-1 0
when i run the program the output is:
1
what's going on?
why the output is not 3?
Nick