I am trying to write some information out to a file. I have a string in hex values and I need to write this out to the output file. The hex string I have is 4b70 4772 64. The string equivalent is KpGrd.
I have:
char a[] = "4b7047726400";
Then when I try to write it out to the output file it writes "4b7047726400" as a string and not hex values. I need it to be written as hex values where byte 1 woiuld be 4b, byte 2 would be 70, etc. Does it need to be converted to the string equivalent of KpGrd and then be written to the output file? Basically, when I open up the output file in a Hex editor I should see the first 6 bytes as 4b 70 47 72 64 and the string equivalent would be KpGrd. thanks.