I'm pretty new to programming c and trying to get from ascii 0x39, 0x39 (99) to the actual hex value 0x63. I've searched many fora but couldn't find a good solution yet. For as far as I know there is no standard function to do this? I can get it to the string 0x36, 0x33 or to an integer, but the actual value 0x63 I don't know how to get. Hope you guys can point me in the right direction
I have been trying this:
Code:
ascii f[2] = {0x39,0x39}; //0x39 , 0x39 , 0x39 , 0x39 , 0x2D , 0x31 , 0x32 , 0x2D , 0x33 , 0x31
char y[2];
int o;
int hj = atoi(&f[0]);
int jj = atoi(&f[1]);
o=jj+10*hj;
sprintf(y,"%x", o);
I guess I should write a conversion function, but I don't know yet where to start..