Reading file using fscanf() in C

后端 未结 4 1843
迷失自我
迷失自我 2020-12-05 11:30

I need to read and print data from a file.
I wrote the program like below,

#include
#include
int main(void)
{
char item[9         


        
4条回答
  •  猫巷女王i
    2020-12-05 12:00

    In your code:

    while(fscanf(fp,"%s %c",item,&status) == 1)  
    

    why 1 and not 2? The scanf functions return the number of objects read.

提交回复
热议问题