Return to Snippet

Revision: 34124
at October 17, 2010 13:40 by mouseroot


Initial Code
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; 
}

Initial URL

                                

Initial Description
Hex2Int("FF")
returns 255
(if anyone has a better way todo this PLEASE let me know ;) )

Initial Title
2byte Hex String to int!

Initial Tags

                                

Initial Language
C++