Hi all,
Sorry for the stupid question... but I havn't used C very often...
How do I convert a string into float?
THANKS!!!
Liat.
Hi all,
Sorry for the stupid question... but I havn't used C very often...
How do I convert a string into float?
THANKS!!!
Liat.
Thanks!!!
I tried atof() and that seems to work fine.
Any major resons to use something else? (are there advantages for using the others?)
Thanks again!
Liat.
strtod() and strtof() allow you to detect if the string isn't a double or float respectively and be able to write a complicated routine to figure out how you want to proceed.
sscanf() has more or less the same limitations of scanf(). It allows some error handling but not as much as strtod() or strtof().