I have a string storing 16 hex chars. For example:
const char* arr = "DD2B23B62AC245DA";
I need to write those chars into a binary file in a format of 8 bytes. Each byte is represented by two hex chars in their hex value. The way I did it is:
unsigned char hexArr[8];
hexArr[0] = 0xDD;
hexArr[1] = 0x2B;
hexArr[2] = 0x23;
...
The problem in that way is that it is hard-coded, and I need to be able to get this array as an input and then to fill the hexArr
array.
When I copy the array itself it sets the hex value of the char D instead of D as a hexadecimal value. Any help how can I do that?