COHERENT manpages
This page displays the COHERENT manpage for atol() [Convert ASCII strings to long integers].
List of available manpages
Index
atol() -- General Function (libc)
Convert ASCII strings to long integers
#include <stdlib.h>
long atol(string) char *string;
atol() converts the argument string to a binary representation of a long.
string may contain a leading sign (but no trailing sign) and any number of
decimal digits. atol() ignores leading blanks and tabs; it stops scanning
when it encounters any non-numeral other than the leading sign, and returns
the resulting long.
Example
#include <stdlib.h>
main()
{
extern char *gets();
extern long atol();
char string[64];
for(;;) {
printf("Enter numeric string: ");
if(gets(string))
printf("%ld\n", atol(string));
else
break;
}
}
See Also
atof(),
atoi(),
float,
libc,
long,
printf(),
scanf(),
stdlib.h
ANSI Standard, §7.10.1.3
POSIX Standard, §8.1
Notes
No overflow checks are performed. atol() returns zero if it receives a
string it cannot interpret.

















