Thursday, 15 August 2013

How to convert literal char hex value into the hex value itself?

How to convert literal char hex value into the hex value itself?

I'm have the literal value that should be stored on an unsigned char[64]
array, how can I convert such values to it's hex equivalent?
int main() {
unsigned char arry[1] = { 0xaa }
char* str = "fe"; //I want to store 0xfe on arry[0]
arry[0] = 0xfe; // this works, but I have to type it arry[0] = 0x + str;
//obviously fails
}
Any pointers?

No comments:

Post a Comment