C Language and Libraries Help (clang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
atof, atoi, atol, _atold
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
─────Run-Time Library───────────────────────────────────────────────────────
The atof, atoi, atol, and _atold functions convert a character
string to a double-precision floating-point value (atof), an
integer value (atoi), a long integer value (atol), or a long
double value (_atold). 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 or _atold
function is limited to 100 characters.
The function stops reading the input string at the first character
that it cannot recognize as part of a number. This character may
be the null character (\0) terminating the string.
The atof and _atold functions expect <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> contains 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, long, or long double value
produced by interpreting the input characters as a number. The
return value is 0 (for atoi), 0L (for atol) and 0.0 (for atof and
_atold) if the input cannot be converted to a value of that type.
The return value is undefined in case of overflow.
-♦-