读取c文件中的字节(对于文件中的所有行)

时间:2016-11-07 11:42:04

标签: c

我试图读取文件每一行的字节。

对于一个文件,它可以工作,但它不适用于另一个文件。

pFile=fopen(table,"rb");

for (c = 0; c <= 256; c++)
{ 
    fgets (line, sizeof line, pFile); /* read a line */
    sscanf(line,"%d ",&x);
    ranges[c]=x;

    printf ("%d\n",ranges[c]);

}

1 个答案:

答案 0 :(得分:0)

sscanf格式字符串中删除空格。

相关问题