writing to file in hex
Posted on 2000-04-10
I am trying to write data to a file in hex. I use the following to write to the file:
unsigned int bfType = 0x424D;
fprintf(output, "%X", bfType);
but it actually writes '424D' to the file as characters, so upon viewing, the hex equivalent is, '34 32 34 44' As I said, I want to write to file in hex, not as chars.. ie, write '424D' to the file, and it would come up in characters as 'BM'. How do I go about doing this correctly??