1ATOI(3) Linux Programmer's Manual ATOI(3)
2
3
4
6 atoi, atol, atoll, atoq - convert a string to an integer
7
9 #include <stdlib.h>
10
11 int atoi(const char *nptr);
12 long atol(const char *nptr);
13 long long atoll(const char *nptr);
14 long long atoq(const char *nptr);
15
17 The atoi() function converts the initial portion of the string pointed
18 to by nptr to int. The behaviour is the same as
19
20 strtol(nptr, (char **)NULL, 10);
21
22 except that atoi() does not detect errors.
23
24 The atol() and atoll() functions behave the same as atoi(), except that
25 they convert the initial portion of the string to their return type of
26 long or long long. atoq() is an obsolete name for atoll().
27
29 The converted value.
30
32 SVr4, POSIX.1-2001, 4.3BSD, C99. C89 and POSIX.1-1996 include the
33 functions atoi() and atol() only. atoq(3) is a GNU extension.
34
36 The non-standard atoq() function is not present in libc 4.6.27 or glibc
37 2, but is present in libc5 and libc 4.7 (though only as an inline func‐
38 tion in <stdlib.h> until libc 5.4.44). The atoll() function is present
39 in glibc 2 since version 2.0.2, but not in libc4 or libc5.
40
42 atof(3), strtod(3), strtol(3), strtoul(3)
43
44
45
46GNU 2000-12-17 ATOI(3)