Syntax
#include <stdlib.h> /* also defined in <math.h> */ long double _atold(const char *nptr);Description
strtold(nptr, (char **)NULL)
The string pointed to by nptr must have the following format: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ ³
³ >>ÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄ>
³
³ ÀÄwhitespaceÄÙ ÀÄÂÄÄÄÄÄÂÄÄÂÄdigitsÄÄÂÄÄÄÂÄÄÂÄÄÄÄÄÄÄÄÂÄÂÄÙ ³
³ ÃÄ + Ä´ ³ ÀÄ.ÄÙ ÀÄdigitsÄÙ ³ ³
³ ÀÄ Á ÄÙ ÀÄ.ÄÄdigitsÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³
³ ³
³ >ÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄ>< ³
³ ÀÄÂÄ e ÄÂÄÄÂÄÄÄÄÄÂÄÄdigitsÄÙ ³
³ ÀÄ E ÄÙ ÃÄ + Ä´ ³
³ ÀÄ Á ÄÙ ³
³ ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
digits is one or more decimal digits. If no digits appear before the decimal point, at least one digit must follow the decimal point. The decimal point character (radix character) is determined by the LC_NUMERIC category of the current locale. You can place an exponent expressed as a decimal integer after the digits. The exponent can be signed.
The value of nptr can also be one of the strings infinity, inf, or nan. These strings are case-insensitive, and can be preceded by a unary minus (-). They are converted to infinity and NaN values. For more information on NaN and infinity values, see Infinity and NaN Support.
_atold ignores any white-space characters, as defined by the isspace function.
This example uses _atold to convert two strings, " -001234.5678e10end of string" and "NaNQ", to their corresponding long double values.
#include <stdlib.h> #include <stdio.h> int main(void) { char *string; string = " -001234.5678e10end of string"; printf("_atold = %.10Le\n", _atold(string)); string = "NaNQ"; printf("_atold = %.10Le\n", _atold(string)); return 0; /**************************************************************************** The output should be: _atold = -1.2345678000e+13 _atold = nan ****************************************************************************/ }Related Information