int i, j;
for (i = (*pgm).height - 1; i >= 0; i--)
for (j = 0; j < (*pgm).width; j++)
{
fscanf(file, "%c", &(*pgm).data[i][j]);
}
}
这是我逐字节读取 PGM 文件的函数的一部分。在这里,在大约 2000 个字节之后,它读取的每个字节都是 0。
我这样理解
我该如何解决这个问题?
编辑:这是 pgm 的定义:
typedef struct PGM
{
int width;
int height;
int maxValue;
unsigned char data[500][500];
} PGM;