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
16 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18 atoll(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
19 _ISOC99_SOURCE; or cc -std=c99
20
22 The atoi() function converts the initial portion of the string pointed
23 to by nptr to int. The behavior is the same as
24
25 strtol(nptr, (char **) NULL, 10);
26
27 except that atoi() does not detect errors.
28
29 The atol() and atoll() functions behave the same as atoi(), except that
30 they convert the initial portion of the string to their return type of
31 long or long long. atoq() is an obsolete name for atoll().
32
34 The converted value.
35
37 SVr4, POSIX.1-2001, 4.3BSD, C99. C89 and POSIX.1-1996 include the
38 functions atoi() and atol() only. atoq() is a GNU extension.
39
41 The non-standard atoq() function is not present in libc 4.6.27 or glibc
42 2, but is present in libc5 and libc 4.7 (though only as an inline func‐
43 tion in <stdlib.h> until libc 5.4.44). The atoll() function is present
44 in glibc 2 since version 2.0.2, but not in libc4 or libc5.
45
47 atof(3), strtod(3), strtol(3), strtoul(3)
48
50 This page is part of release 3.22 of the Linux man-pages project. A
51 description of the project, and information about reporting bugs, can
52 be found at http://www.kernel.org/doc/man-pages/.
53
54
55
56GNU 2007-07-26 ATOI(3)