typedef struct Test01 { char def [10] ; char efg[4]; // holds an integer value in hexa representation char xyz [10]; } test01_t int main ( int argc , char ** argv ) { test01_t tt01 ; memcpy ( tt01.def , "EFG" ,3 ) ; memcpy ( tt01.xyz , "XYZ" ,3 ) ; tt01.efg[0] = 0X0 ; tt01.efg[1] = 0X0 ; tt01.efg[2] = 0X04 ; tt01.efg[3] = 0XB0 ; }
how can I obtain the 1200 integer value which is the equivalent to "0x0004B0" ?
I know it is a dummy question, but I cannot get with sscanf, sprintf
Thanks in advance.
Discuss This Question: 9  Replies
But assigning the individual chars as numbers the way you are doing it, does not produce the string you want to convert to decimal.
In other words, 0x0 is a different thing than "0x0".