atof [C++ Reference]
Keywords: c,string,atof
Date: 2008-10-14T15:42:02-0700

[[atof]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## atof

Syntax:

        #include <cstdlib>
        double atof( const char *str );

The function atof() converts str into a double, then returns that value. str must start with a valid number, but can be terminated with any non-numerical character, other than “E” or “e”. For example,

         x = atof( "42.0 is the answer" );

results in x being set to 42.0.

Related Topics: atoi, atol, sprintf, strtod

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •