Reading file using fscanf() in C

后端 未结 4 1839
迷失自我
迷失自我 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条回答
  •  青春惊慌失措
    2020-12-05 11:59

    fscanf will treat 2 arguments, and thus return 2. Your while statement will be false, hence never displaying what has been read, plus as it has read only 1 line, if is not at EOF, resulting in what you see.

提交回复
热议问题