0xA3 is hex, you'll need and integer string like "163" for atoi() to work for you. But if you are going to do that, you might as well just write a hextoi() function yourself.
Here is a simple conversion that will take a two digit hex string in the format "0xHH" and convert it to an int:
#include <ctype.h>
int hextoi(const char * valstr) {
char valchr[3];
strncpy(valchr, &valstr[2], 3);
valchr[0] = toupper(valchr[0]);
valchr[1] = toupper(valchr[1]);
int result = 0;
int positionValue = 1;
for (int i = 1; i >= 0; i--) {
int valc = 0;
if (isalpha(valchr[i])) {
valc = (int)valchr[i] - (int)'A' + 10;
}
else if (isnumber(valchr[i])) {
valc = (int)valchr[i] - (int)'0';
}
result += (valc * positionValue);
positionValue = positionValue << 4;
}
return result;
}
int main (int argc, char * const argv[]) {
int result = hextoi("0xa3");
printf("%d", result);
}
If you want a char value result, it's easy to convert this function to do that.