vendredi 31 juillet 2015

Converting a string from a structure into a floating value

string[0].float

Has a 7 character string of "420.42" (4, 2, 0, ., 4, 2, \0)

When I try to convert it into a float via atof as

float flt = 0;
flt = atof(string[0].float);

The value of flt is not 420.42, am I doing it wrong or is there a different way?

Aucun commentaire:

Enregistrer un commentaire