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]);
}
}
This is a part of my function for reading a PGM file byte by byte. In this for, after something like 2000 bytes, every byte that it reads is 0.
Instead of reading the image like this
I get it like this
How can i solve this?
Edit: this is the definition of the pgm:
typedef struct PGM
{
int width;
int height;
int maxValue;
unsigned char data[500][500];
} PGM;