PDA

View Full Version : Parsing Doubles in C++



Trinithis
08-28-2007, 06:43 PM
How can I parse a double from a char or a string in C++?

Twey
08-28-2007, 07:08 PM
#include <cstdlib>

// ...

double dbl = strtod(cptr, NULL);
dbl = strtod(str.c_str(), NULL);