一個HexToInt的C/C++函數
睿豐德科技 專注RFID識別技術和條碼識別技術與管理軟件的集成項目。質量追溯系統、MES系統、金蝶與條碼系統對接、用友與條碼系統對接
int BetterVenca25(char* hex)
{
int res=0;
for(;*hex;hex++)
{ int d=toupper(*hex);
if(d >='0' && d <='9')d-='0';
else
if(d >='A' && d <='F')d-='A'-10;
else return -1;
res=res*16+d;
}
return res;
}