Manual Page Result
0
Command: atof | Section: 3 | Source: UNIX v10 | File: atof.3
ATOF(3) Library Functions Manual ATOF(3)
NAME
atof, atoi, atol, strtod, strtol, strtoul - convert ASCII to numbers
SYNOPSIS
double atof(nptr)
char *nptr;
int atoi(nptr)
char *nptr;
long atol(nptr)
char *nptr;
double strtod(nptr, rptr)
char *nptr, **rptr;
long strtol(nptr, rptr, base)
char *nptr, **rptr;
unsigned long strtoul(nptr, rptr, base)
char *nptr, **rptr;
DESCRIPTION
Atof, atoi, and atol convert a string pointed to by nptr to floating,
integer, and long integer representation respectively. The first un-
recognized character ends the string.
Atof recognizes an optional string of tabs and spaces, then an optional
sign, then a string of digits optionally containing a decimal point,
then an optional or followed by an optionally signed integer.
Atoi and atol recognize an optional string of tabs and spaces, then an
optional sign, then a string of decimal digits.
Strtod, strtol, and strtoul, behave similarly to atof, and atol and, if
rptr is not zero, set *rptr to point to the input character immediately
after the string converted.
Strtol and strtoul interpret the digit string in the specified base,
from 2 to 36, each digit being less than the base. Digits with value
over 9 are represented by letters, a-z or A-Z. If base is 0, the input
is interpreted as an integral constant in the style of C (with no suf-
fixed type indicators): numbers are octal if they begin with hexadeci-
mal if they begin with or otherwise decimal. Strtoul does not recog-
nize signs.
SEE ALSO
scanf(3)
DIAGNOSTICS
Zero is returned if the begining of the input string is not inter-
pretable as a number.
If overflow is detected by atof, strtod, strtol, or strtoul, a maximum
value of the correct sign is returned and errno is set to ERANGE.
BUGS
Atoi and atol have no provisions for overflow.
ATOF(3)