I have no problem reading and writing ASCII-format PGM files.

However, when I try to read a raw-format PGM file, my program goes nuts. I've read that some people have been successful at reading and writing them, but I have no idea what tools they used to achieve that. I still need to find a parser that correctly converts these random-looking characters to something legible.

Thank you in advance for your help.