

atol()                   General Function                  atol()




Convert ASCII strings to long integers

lloonngg aattooll(_s_t_r_i_n_g) cchhaarr *_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


