>Use atof().
No, use strtod. The ato* functions are unsafe because they result in undefined behavior if the value is outside of the range for the particular type. You also can't determine how many characters of the original string were a part of the conversion. Both of these problems can be solved by using the strto* functions instead.

>error C2664: 'atof' : cannot convert parameter 1 from 'class std::basic_string<snip>' to 'const char *'
This is because you are using a C++ string, not an array of char terminated by a nul character. For your code to work, you should convert the string to a C string:

Code:

atof ( my_string.c_str() );

Once again, I recommend using strtod instead of atof for safety reasons.

The strtod function converts nptr to a double-precision value. strtod stops reading the string nptr at the first character it cannot recognize as part of a number. This may be the terminating null character. wcstod is a wide-character version of strtod; its nptr argument is a wide-character string. Otherwise these functions behave identically

***the lowly Grayson_Peddie bows to the Code Goddess.
thanks for the rebuke, Prelude. I didn't have any experience with strtod before (atof hadn't failed me (yet)), so I learned something new.**