c - How to convert literal char hex value into the hex value itself? -
i'm having literal value should stored on unsigned char[64]
array. how can convert such values it's hex equivalent?
int main() { unsigned char arry[1] = { 0xaa } char* str = "fe"; //i want store 0xfe on arry[0] arry[0] = 0xfe; // works, have type arry[0] = 0x + str; //obviously fails return 0; }
any pointers?
arr[0] = strtol(str,null,16); // if 1 entry big enough hold it.
Comments
Post a Comment