xtoi (Hex to Integer) C function - Nanoseconds Network

xtoi (Hex to Integer) C function - Nanoseconds Network

xtoi (Hex to Integer) C function

Tuesday, June 20, 2006 6:06 PM by cvega

You mean "int to hex"?

Use sprintf:

char* output;
unsigned int value = 43981;
sprintf(output, "%X", value);

xtoi (Hex to Integer) C function - Nanoseconds Network

Edit:
From the comment below the page, you can see the C way of decoding hex from string using sscanf function:

unsigned int hex = 0;
const char* hexstr = "ABCD";

sscanf(hexstr, "%X", &hex);
printf("%s = %d\n", hexstr, hex);

你可能感兴趣的:(function)