Need help here...
Writing a program that reads in a PPM image, modifies it, and spits it back out.
I can make it work for a regular PPM header, like this one:
but there are some that are like this:
Code:
P6
# CREATOR: GIMP PNM Filter Version 1.1
600 399
255
This is a school assignment and people in my class frequent these forums, so I can't post my complete code. The file needs to account for ALL types of PPM headers, not just the first example.
As I said, I can't copy my entire code here, but here's the snippet that reads in PPM header data..
Code:
if (fscanf(inFile, "P6 %d %d", &width, &height) != 2)
{
fprintf(stderr, "Invalid image size.\n");
exit(1);
}
any ideas?