I have a string that i want to convert to double. i know atof is a standard library function for that, however, the input argument to atof is (const char*), not string type that i have.
does anyone know how i might convert my string num to double ? thanks
I have a string that i want to convert to double. i know atof is a standard library function for that, however, the input argument to atof is (const char*), not string type that i have.
does anyone know how i might convert my string num to double ? thanks
Code:
string num = "45.00";
double x = atof(num);
string is C++ type. It's not part of C. Are you sure it's a C code?