int x = strtol(hex.c_str(), NULL, 16);
sscanf, . , :
int x;
if( 1 == sscanf(hex.c_str(), "%2x", &x) ) {
printf( "Value is: %d\n", x );
} else {
printf( "Conversion failed\n" );
}
, ++. std::hex ( , mystr ( std):
int x;
std::istringstream iss(mystr);
bool ok = (iss >> std::hex >> x);
[edit] , . , unsigned int?
unsigned strtoul.