aattooll() -- General Function (libc)

Convert ASCII strings to long integers
#iinncclluuddee <ssttddlliibb.hh>
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;

aattooll() converts  the argument _s_t_r_i_n_g to a binary  representation of a lloonngg.
_s_t_r_i_n_g may contain a leading sign  (but no trailing sign) and any number of
decimal digits.  aattooll() ignores  leading blanks and tabs; it stops scanning
when it encounters any non-numeral other than the leading sign, and returns
the resulting lloonngg.

_E_x_a_m_p_l_e

#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;
    }
}

_S_e_e _A_l_s_o
aattooff(), aattooii(), ffllooaatt, lliibbcc, lloonngg, pprriinnttff(), ssccaannff(), ssttddlliibb.hh
ANSI Standard, section 7.10.1.3
POSIX Standard, section 8.1

_N_o_t_e_s
No overflow  checks are  performed.  aattooll() returns  zero if it  receives a
string it cannot interpret.
