How to skip a line when fscanning a text file?

前端 未结 4 630
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 09:03

I want to scan a file and skip a line of text before reading. I tried:

fscanf(pointer,\"\\n\",&(*struct).test[i][j]);

But this syntax s

4条回答
  •  执念已碎
    2020-11-30 09:45

    fgets would work here.

    #define MAX_LINE_LENGTH 80
    
    char buf[MAX_LINE_LENGTH];
    
    /* skip the first line (pFile is the pointer to your file handle): */
    fgets(buf, MAX_LINE_LENGTH, pFile);
    
    /* now you can read the rest of your formatted lines */
    

提交回复
热议问题