I was trying to achieve this using this code:
char c;
while (std::cin >> c)
std::cout << std::hex << std::setw(2) << std::setfill('0') << static_cast<uint32_t>(c);
but it looks like it gets messed up reading in nulls (all nulls are removed from my file). How can I fix this?
The input stream operator typically requires a separator, you should read a buffer from the file, something like shown here: http://www.cplusplus.com/reference/iostream/istream/read/, then iterate over the contents and print out, you may also want to use
showbaseto make the hex output prettier…EDIT: try something like this: