I would like to to convert string to double. I do that this way:
bool String2ValueType(const std::string & a_str_value_type, double & a_result)
{
if(a_str_value_type.empty())
return false;
char * end;
double result = strtod(a_str_value_type.c_str(), &end);
if(*end!=NULL)
return false;
a_result = result;
return true;
}
How can I check if result is fine, or not, if it's value is 0? for example i will get 0 if I will send string("0"), and this is not error. But I can also send some other string- that is number, but it will not be converted and I will get also 0 (error), ( I'm talking about case when *end == 0 ).