]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/atoi.3
pthread_attr_init.3: Use correct printf() specifier for "size_t" in example program
[thirdparty/man-pages.git] / man3 / atoi.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" References consulted:
26.\" Linux libc source code
27.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28.\" 386BSD man pages
29.\" Modified Mon Mar 29 22:39:41 1993, David Metcalfe
30.\" Modified Sat Jul 24 21:38:42 1993, Rik Faith (faith@cs.unc.edu)
31.\" Modified Sun Dec 17 18:35:06 2000, Joseph S. Myers
32.\"
97986708 33.TH ATOI 3 2016-03-15 "GNU" "Linux Programmer's Manual"
fea681da 34.SH NAME
47aa42e7 35atoi, atol, atoll \- convert a string to an integer
fea681da
MK
36.SH SYNOPSIS
37.nf
38.B #include <stdlib.h>
68e4db0a 39.PP
fea681da 40.BI "int atoi(const char *" nptr );
fea681da 41.BI "long atol(const char *" nptr );
fea681da 42.BI "long long atoll(const char *" nptr );
fea681da 43.fi
68e4db0a 44.PP
cc4615cc
MK
45.in -4n
46Feature Test Macro Requirements for glibc (see
47.BR feature_test_macros (7)):
48.in
68e4db0a 49.PP
cc4615cc
MK
50.ad l
51.BR atoll ():
e0a98111 52.RS 4
2b1b0424
MK
53__ISOC99_SOURCE ||
54 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
e0a98111
MK
55.RE
56.ad
fea681da 57.SH DESCRIPTION
60a90ecd
MK
58The
59.BR atoi ()
60function converts the initial portion of the string
fea681da
MK
61pointed to by \fInptr\fP to
62.IR int .
d9bfdb9c 63The behavior is the same as
ba39b288 64.PP
2147452b 65.in +4n
ba39b288 66.EX
13f78d96 67strtol(nptr, NULL, 10);
ba39b288 68.EE
2147452b 69.in
ba39b288 70.PP
60a90ecd
MK
71except that
72.BR atoi ()
73does not detect errors.
fea681da 74.PP
60a90ecd
MK
75The
76.BR atol ()
77and
78.BR atoll ()
79functions behave the same as
80.BR atoi (),
81except that they convert the initial portion of the
fea681da 82string to their return type of \fIlong\fP or \fIlong long\fP.
47297adb 83.SH RETURN VALUE
fea681da 84The converted value.
843204f8 85.SH ATTRIBUTES
fe41ec5e
PH
86For an explanation of the terms used in this section, see
87.BR attributes (7).
88.TS
89allbox;
90lbw23 lb lb
91l l l.
92Interface Attribute Value
93T{
843204f8
PH
94.BR atoi (),
95.BR atol (),
843204f8 96.BR atoll ()
fe41ec5e
PH
97T} Thread safety MT-Safe locale
98.TE
47297adb 99.SH CONFORMING TO
4e73f286 100POSIX.1-2001, POSIX.1-2008, C99, SVr4, 4.3BSD.
68e1685c 101C89 and
60a90ecd
MK
102POSIX.1-1996 include the functions
103.BR atoi ()
104and
105.BR atol ()
106only.
fea681da 107.SH NOTES
ee5f0bfd 108Linux libc provided
60a90ecd 109.BR atoq ()
ee5f0bfd
MK
110as an obsolete name for
111.BR atoll ();
112.BR atoq ()
113is not provided by glibc.
114.\" The
115.\" .BR atoll ()
116.\" function is present in glibc 2 since version 2.0.2, but
117.\" not in libc4 or libc5.
47297adb 118.SH SEE ALSO
fea681da
MK
119.BR atof (3),
120.BR strtod (3),
121.BR strtol (3),
122.BR strtoul (3)