I'm making a program that has to read in and manipulate a pgm file. I need to make sure the first line in the file is P2, not P5. How would i go about doing this?
so far i have something like this:
When i print out buffer[1] i get some big ass number. What am i doing wrong?Code:int continue; FILE *in; char buffer[MAXSIZE]; in = fopen(image.pgm, "r"); fgets(buffer, MAXSIZE, in); if( buffer[1] != 2 ) { printf("Incorrect data type.\n"); exit(0); }