|
|
coherent
atol() General Function atol()
Convert ASCII strings to long integers
lloonngg aattooll(_s_t_r_i_n_g) cchhaarr *_s_t_r_i_n_g;
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 *****
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, long, printf(), scanf()
***** Notes *****
No overflow checks are performed. atol returns zero if it
receives a string it cannot interpret.
COHERENT Lexicon Page 1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.