1ATOI(3) Linux Programmer's Manual ATOI(3)
2
3
4
6 atoi, atol, atoll - 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
15 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17 atoll():
18 _ISOC99_SOURCE ||
19 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
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, 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.
32
34 The converted value.
35
37 For an explanation of the terms used in this section, see
38 attributes(7).
39
40 ┌────────────────────────┬───────────────┬────────────────┐
41 │Interface │ Attribute │ Value │
42 ├────────────────────────┼───────────────┼────────────────┤
43 │atoi(), atol(), atoll() │ Thread safety │ MT-Safe locale │
44 └────────────────────────┴───────────────┴────────────────┘
46 POSIX.1-2001, POSIX.1-2008, C99, SVr4, 4.3BSD. C89 and POSIX.1-1996
47 include the functions atoi() and atol() only.
48
50 atof(3), strtod(3), strtol(3), strtoul(3)
51
53 This page is part of release 5.07 of the Linux man-pages project. A
54 description of the project, information about reporting bugs, and the
55 latest version of this page, can be found at
56 https://www.kernel.org/doc/man-pages/.
57
58
59
60GNU 2020-04-11 ATOI(3)