/ Published in: C++
Hex2Int("FF")
returns 255
(if anyone has a better way todo this PLEASE let me know ;) )
returns 255
(if anyone has a better way todo this PLEASE let me know ;) )
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
int Hex2Int(char i[]) { int d=0; int a =0; char out[10]; sscanf(i, "%02x", &a); sprintf(out, "%d",a); stringstream(out) >> d ; return d; }