Number text into float

I know how to translate a number in a string, but how do I do things back, I mean, write like -15.36, which is not only decimal digits, to transfer from the edit boxe of the dialog box into a value (maybe using GetDlgItemText )

But how to transfer it into a string and after into a float



Answer this question

Number text into float

  • Dan Balaceanu

    char str[256];
    double -> string: sprintf(str, "%.2f", doublevar);
    string -> double: doublevar = strtod(str);



  • Number text into float