You could use sscanf and check the return value to see if it did something useful, e.g.:
bool parseValue (const char *buffer, long &value)
{
if (sscanf(buffer,"%ld",&value)==1) return true;
if (sscanf(buffer,"0x%lx",&value)==1) return true;
...
return false;
}
You can easily add more kinds of formats to this list.
To extend this for floating point values as well, scan the buffer in a floating point value then cast or round it to the integer value, like this:
bool parseValue (const char *buffer, long &value)
{
if (sscanf(buffer,"%ld",&value)==1) return true;
if (sscanf(buffer,"0x%lx",&value)==1) return true;
...
double d;
if (sscanf(buffer,"%lf",&d)==1) {value=d; return true;}
...
return false;
}