How to ignore the pound sign?
I'm writing a program that will read files that will check to see if it's the right type (PGM, type P2), within the max height and width (200 each), max greyscale value, and can later be smoothed out. Right now i'm having trouble trying to figure out how to ignore strings denoted by a pound sign
P2
#blahblah this is a comment
height width grayscalevalue
Because comments can be anywhere
P2
height width
#comment
grayscale value
How would I go about this? (I have the basic open/read/close file thing down, while looping with fgets to go through the string...) And then to later take the values individually of the height, width, and grayscale? I think we're supposed to use sscanf(string, format, pointer) or fscanf(file..??)
Er, stuck on this for hours. I've been reading the man pages on them but I think if you could point me to examples, they would be more useful. Thanks