atof()

convert string to double-precision number 

Function


SYNOPSIS

#include <stdlib.h>

double atof(const char *nptr);


DESCRIPTION

The atof() function converts a string pointed to by nptr to a double-precision number. This function recognizes (in order) an optional string of spaces, an optional sign, a string of digits optionally containing a radix character, an optional 'e' or 'E', and then an optionally signed integer. The first unrecognized character ends the string.

The radix character for atof() is that defined by the last successful call to setlocale(), category LC_NUMERIC. If setlocale(), category LC_NUMERIC, has not been called successfully, or if the radix is not defined for a supported language, the radix character is defined as a period (.).

The call atof(nptr) is equivalent to:

strtod(nptr,(char **)NULL)

PARAMETERS

nptr 

Pointer to a character string.


RETURN VALUES

The atof() functions returns the converted number.

If the correct value overflows, ┬▒Infis returned (according to the sign of the value). If the correct value would cause an underflow, zero is returned.


CONFORMANCE

ANSI/ISO 9899-1990


MULTITHREAD SAFETY LEVEL

MT-Safe, with exceptions.

This function is MT-Safe as long as no thread calls setlocale() while this function is executing.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
atoi(), atol(), setlocale(), strtod()


PTC MKS Toolkit 10.3 Documentation Build 39.