convert <span class="Tn">ASCII</span> string to double

You're viewing an older version of this page (#3232). View the current version.

View versions (3)

NAME

<span class="Nm" id="atof">atof</span>, <span class="Nm" id="atof_l">atof_l</span>

INTERFACE

#include <stdlib.h> double atof ( const char *nptr ) #include <xlocale.h> double atof_l ( const char *nptr, locale_t loc )

DESCRIPTION

The atof function converts the initial portion of the string pointed to by &#92;c nptr to <span class="Vt">double</span> representation. &#92;n &#92;n It is equivalent to:

strtod(nptr, (char **)NULL);

&#92;n &#92;n The decimal point character is defined in the program's locale (category <span class="Dv">LC_NUMERIC</span>). &#92;n &#92;n While the atof function uses the current locale, the atof_l function may be passed a locale directly. See reference:xlocale (3) for more information.

IMPLEMENTATION NOTES

The atof function is not thread-safe and also not async-cancel-safe. &#92;n &#92;n The atof function has been deprecated by strtod and should not be used in new code.

ERRORS

The function atof need not affect the value of <span class="Va">errno</span> on an error.

SEE ALSO

atoi (3) , atol (3) , strtod (3) , strtol (3) , strtoul (3) , reference:xlocale (3)

STANDARDS

The atof function conforms to and