Here is a function that I've used for a while
Code:
#include <ctype.h>
unsigned long atoh(char *ivalue){
char *value = ivalue;
unsigned long rtrVal=0, i, end;
if((strstr(ivalue, "0X") == ivalue) || (strstr(ivalue, "0x") == ivalue))
value+=2;
for(end=0, i = 0; isxdigit(value[i]); i++, end++);
for(i = 0; i < end; i++){
word bwI = (end-1) - i;
word iChr;
char lChr = toupper(value[i]);
if(lChr > 64 && lChr < 71)
iChr = lChr-55;
else if(lChr > 48 && lChr < 58)
iChr = (lChr - 48);
else
iChr = 0;
if(iChr > 0)
rtrVal += iChr << (bwI << 2);
}
return rtrVal;
}
However, it is all c. But you should be able to throw using namespace std in there and be just fine.