Original Post
While trying to load flat bytes (unsigned char) from a PNG file, I realized i was using the clunky old fread() and FILE* combination, which seemed sort of inelegant compared to the more C++ ifstreams. So, in trying to convert to it, i realized that i'd never read flat bytes using that method, and that, (surprise surprise) there's no method to do it. I tried using reinterpret_cast, but it just errored out during the read. I tried a quick hack to this effect.. Thinking myself clever, it ran and didn't crash. Oh, but the best part, it gave incorrect results. For whatever reason, it doesn't give me the same bit pattern as fread() did, and also doesn't line up to what PNG specification says should be the initial bytes. Is there any way to read flat bytes without writing a novella of workaround code, or should I just go back to fread() and deal with it?
//unsigned char inValue
//ifstream* in
in->read((char*)&inValue);