1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
27 .\" Modified Mon Mar 29 22:39:41 1993, David Metcalfe
28 .\" Modified Sat Jul 24 21:38:42 1993, Rik Faith (faith@cs.unc.edu)
29 .\" Modified Sun Dec 17 18:35:06 2000, Joseph S. Myers
31 .TH ATOI 3 2010-09-20 "GNU" "Linux Programmer's Manual"
33 atoi, atol, atoll, atoq \- convert a string to an integer
36 .B #include <stdlib.h>
38 .BI "int atoi(const char *" nptr );
40 .BI "long atol(const char *" nptr );
42 .BI "long long atoll(const char *" nptr );
44 .BI "long long atoq(const char *" nptr );
48 Feature Test Macro Requirements for glibc (see
49 .BR feature_test_macros (7)):
55 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
56 _POSIX_C_SOURCE\ >=\ 200112L;
65 function converts the initial portion of the string
66 pointed to by \fInptr\fP to
68 The behavior is the same as
71 strtol(nptr, (char **) NULL, 10);
76 does not detect errors.
82 functions behave the same as
84 except that they convert the initial portion of the
85 string to their return type of \fIlong\fP or \fIlong long\fP.
87 is an obsolete name for
92 SVr4, POSIX.1-2001, 4.3BSD, C99.
94 POSIX.1-1996 include the functions
104 function is not present in libc 4.6.27
105 or glibc 2, but is present in libc5 and libc 4.7 (though only as an
106 inline function in \fI<stdlib.h>\fP until libc 5.4.44).
109 function is present in glibc 2 since version 2.0.2, but
110 not in libc4 or libc5.