I have a c++ string of data. I want to dump this data as hex to a file. I'm not talking about just converting each character to its hex representation. I want to actually dump binary to a file.
How do you dump hex to a file using c++?
ofstream outf;
outf.open("dump", ios::binary);
ios::binary informs open that no translation of data to file is to be performed.
Basically, you write '\n' to a data file in text, it translates to '\r\n'
'\r' by itself does not get translated.
outf.write(data, data_size);
outf.close();
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment