I want to convert a char * to a double in c++. But before do that, I want to check that the char * is a right double number. So I have made this code :
bool Tools::m_CheckIfDouble(char *p_nb)
{
if (p_nb == NULL)
return (false);
for (unsigned int v_i = 0; p_nb[v_i]; v_i++)
if ((p_nb[v_i] < '0' || p_nb[v_i] > '9') && (p_nb[v_i] != '.' && p_nb[v_i] != '-'))
return (false);
return (true);
}
but I don't know how to check the char * for a double overflow (if the value of the char * is greater than the value of DBL_MAX or lesser than DBL_MIX).