Atof
4704984
225801257
2008-07-15T13:46:47Z
Btx40
6819698
{{lowercase|title=atof}}
The '''atof''' function in the [[C programming language]] is used to convert a string into a numerical representation.
:<code>double atof (const char *string) </code>
Note that where as <code>[[atoi]]</code> and <code>[[Atol (programming)|atol]]</code> return variable types corresponding with their name ("<code>ato'''i'''</code>" integer and "<code>ato'''l'''</code>" long integer), atof however, does not. Because of that, people tend to expect atof to return a <code>float</code>, while in fact it returns a <code>double</code>.
Where <code>string</code> is the textual representation of a <code>double</code>. If the string is not a valid textual representation of a <code>double</code>, <code>atof</code> will silently fail, returning a random value. It's better and safer to use <code>[[strtod]]</code>.
[[Category:stdlib.h]]
[[ja:Atof]]