ATOL - convert ASCII string to long integer.

(ANSI Standard)

Usage:

#include <stdlib.h>
li = atol( s );

Where:

const char *s;
points to a string of ASCII characters which correspond to a valid long integer, e.g. "-325".
int i;
is the long integer corresponding to the given ASCII string.

Description:

"atol" converts the string pointed to by "s" into a long integer. The string may consist of any number of blanks and/or tabs, possibly followed by a sign, followed by a string of digits. Conversion stops when the first non-digit is encountered.

Notes:

Previous versions of "atol" treated a number as octal if it had a leading zero and decimal otherwise. The ANSI standard requires that "atol" behave like

strtol(s,NULL,10)

which means that numbers are always treated as decimal. The current version of "atol" follows the ANSI standard.

See Also:

expl c lib strtol

expl c lib scanf

expl c lib atoi

Copyright © 1996, Thinkage Ltd.