I have
sprintf(ascii,"%X",number) // number = 63 is a decimal integer`
char ascii[] = {51, 70, 0, 0, 0, .... }
which displayed as "3F"
When I have
value = atoi(ascii);
It returns value = 3
not 63.
The thing that I want is hexadecimal conversion with sprintf, display it but then save the value inside the table as decimal to another variable.
How it can be done ?
The problem is atoi doesn't parse hex. You need a function that parses a hex digit. sscanf(ascii, "%x", &i)
comes to mind...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With