Got an assignment where I need to convert between pgm and ppm. Now I know about the homework guideline so i went ahead to try to do up everything first and I managed to get it right. Or so it seems.
The problem starts to come in when I try to convert bigger files. The top part of the image will be converted correctly but the bottom part would be left blank. As if I did not read in the full image info.
what i did was to get the length of the data and create an unsigned char array to store it using the length. Next I would use the read() function to read into the array the info required
file.read( reinterpret_cast<char *>(img), (w)*sizeof(unsigned char));
But it seems that after a few read()s, it will just stop there and the rest will not be read in.
Really hope someone can help here as I have spent the last day or so trying to figure it out.
Thanks In Advance. :)