koger
asked on
String to float
How do I convert a string value to a float.
A small example would be great :)
A small example would be great :)
Here is the code to convert string to double. (There no api available to convert the string to float directly.) Here is the code sample:
#include <stdlib.h>
main()
{
char* str; *stopstr;
}
#include <stdlib.h>
main()
{
char* str; *stopstr;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
sorry, you have to use "strtod" instead of "strtol". Typing mistake.
Thangs
sorry, you have to use "strtod" instead of "strtol". Typing mistake.
Thangs
=> koger
Would you mind telling me why you didn't like my answer?
Would you mind telling me why you didn't like my answer?
float fVal = atof(strName);