We use strtoul()
I don't know if it's ANSI, but it is included with the Microsoft Compiler. (And I forgot to look-up which library it's in.)
here's a code fragment from an existing C program:
Code:
unsigned RtnValue, testdata, testdata2, datamask;
char command[32], *ptr;
gets(command); // get command from kybd
if(!strcmpi(command, "exit"))
return 1;
if(!strlen(command))
datamask = 0xFFFF;
else
datamask = (int)strtoul(command, &ptr, 16); //**** strtoul() ****
printf("Data mask = %04X\n", datamask);
[edit]
strtoul() is ANSI and it's in stdlib.h ...of all places!
[/edit/