Include: or (atof)
(atoi, atol)
Prototype: double atof(const char *string);
int atoi(const char *string);
long atol(const char *string);
Returns: the converted string, or 0 if string cannot be converted.
See also: ecvt, fcvt, gcvt
These functions convert a character string to a double-precision floating-
point value (atof), an integer value (atoi), or a long integer value
(atol). The input string is a sequence of characters that can be
interpreted as a numeric value of the specified type.
The size of string that can be handled by the atof function is limited to
100 characters.
The function stops reading the input string at the first character it
cannot recognize as part of a number. This character may be the null
character (\0) terminating the string.
The atof function expects string to have the following form:
[whitespace] [{sign}] [digits] [.digits] [{d|D|e|E} [sign] digits]
A whitespace consists of space and/or tab characters, which are ignored;
sign is either + or -; and digits are one or more decimal digits. If no
digits appear before the decimal point, at least one must appear after the
decimal point. The decimal digits may be followed by an exponent, which
consists of an introductory letter (d, D, e, or E) and an optionally
signed decimal integer.
The atoi and atol functions do not recognize decimal points or exponents.
The string argument for these functions has the form
[whitespace] [sign] digits
where whitespace, sign, and digits are exactly as described above for
atof.
Return Value
Each function returns the double, int, or long value produced by
interpreting the input characters as a number. The return value is 0 (0L
for atol) if the input cannot be converted to a value of that type. The
return value is undefined in case of overflow.