how to convert string to float?

Hi,
i have 2 strings:

string a="100.10"
string b="200.10"

how to convert to float so to be summed: 100.10+200.10=300.20 ????

i tried:

float aNumero=strtof(a) // string to float
float bNumero=strtof(b)

but got error:

cannot convert 'std::string {aka std::basic_string<char>}' to 'const char*' for argument '1' to 'float strtof(const char*, char**)'|
Solved:

string a="100.10"
string b="200.10"

aNumero=strtof((a).c_str(),0) // string to float
bNumero=strtof((b).c_str(),0)
Topic archived. No new replies allowed.