I want to convert this char
array of formatted hex values to a lookup table of hex values.
Something like this:
char crc_input[300] = "abcd12344f..."; // input
unsigned char buf[4096] = { 0xab, 0xcd, 0x12, ... }; // output
I tried this code:
char crc_input[300] = "abcd12344f";
unsigned char buffer[20];
unsigned char output[400];
buffer[0] = crc_input[0]; // a
buffer[1] = crc_input[1]; // b
sprintf(output[0], "0x%s%s", buffer[0], buffer[1]);
printf("output[0] : %s",output[0]);
But apparently the unsigned char
array can't hold entire 0xXX value.
Is there any other way to approach this?