aboutsummaryrefslogtreecommitdiff
path: root/src/base/string/raw/atoi.c
blob: d407411fe015b663f8bcfc9a5ae0a0872efe29be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
long
strยทatoi(char *s)
{
    long neg=0, n = 0;

    /* check for sign */
    if(*s == '-')
        neg=1,s++;
    else if(*s == '+')
        s++;

    while(*s)
        n = 10*n + (*s++ - '0');

    return neg ? -n : +n;
}