I'm not sure how to put what I am trying to achieve in words, but I'll just put an example below, hope you guys can lend me a hand!
Basically I'm trying to copy the hex representation of uint64_t value into an unsigned char array, in hex.
What I have:
uint64_t src;
unsigned char destination[8];
/* codes omitted, some codes that will change the value of src */
printf("src: %"PRIx64"\n", src); //this prints out src: 3132333435363738
How do I copy the values from src into destination array in a way that:
destination[0] = 0x31;
destination[1] = 0x32;
destination[2] = 0x33;
//and so on...
Thanks!
EDIT
I'm sorry If my question is unclear, I'm very new to programming and I'm struggling to explain myself. Basically I'm just trying to store whatever that prints out from that printf() into the unsigned char array as hex.
e.g, printf() outputs a string of "3132333435363738", I want to take 31 and store it in dst[0] where the value of dst[0] will be 0x31, and so on, where dst[1] will be 0x32.
Please bear with me, thanks!