C++ PNM reader/writer