I am having trouble writing the PGM header info to a new pgm file. When i do a hex dump of the first 20 bytes of the original and new header, i can see that "P5" is correct in both the original and new files, after that the, the original file has the width, heigh and maxgrey values set. The new file does not have the correct values set, it just reads as "." on the hex dump. Should i be using fwrite() to output the header data or fprintf()? If i should be using fwrite, should i be using individual fwrite() statements for each piece of the header or can i just have a pointer at the beginning of my struct (i put the original header data into a struct) and fwrite() from there?
Thanks in advance.