]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
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. | |
6 | .\" | |
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. | |
11 | .\" | |
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 | |
18 | .\" professionally. | |
19 | .\" | |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
22 | .\" | |
23 | .\" References consulted: | |
24 | .\" Linux libc source code | |
25 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
26 | .\" 386BSD man pages | |
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 | |
30 | .\" | |
31 | .TH ATOI 3 2000-12-17 "GNU" "Linux Programmer's Manual" | |
32 | .SH NAME | |
33 | atoi, atol, atoll, atoq \- convert a string to an integer | |
34 | .SH SYNOPSIS | |
35 | .nf | |
36 | .B #include <stdlib.h> | |
37 | .sp | |
38 | .BI "int atoi(const char *" nptr ); | |
39 | .br | |
40 | .BI "long atol(const char *" nptr ); | |
41 | .br | |
42 | .BI "long long atoll(const char *" nptr ); | |
43 | .br | |
44 | .BI "long long atoq(const char *" nptr ); | |
45 | .fi | |
46 | .SH DESCRIPTION | |
63aa9df0 | 47 | The \fBatoi\fP() function converts the initial portion of the string |
fea681da MK |
48 | pointed to by \fInptr\fP to |
49 | .IR int . | |
50 | The behaviour is the same as | |
51 | .sp | |
52 | .RS | |
b9f02710 | 53 | .B strtol(nptr, (char **) NULL, 10); |
fea681da MK |
54 | .RE |
55 | .sp | |
63aa9df0 | 56 | except that \fBatoi\fP() does not detect errors. |
fea681da | 57 | .PP |
63aa9df0 MK |
58 | The \fBatol\fP() and \fBatoll\fP() functions behave the same as |
59 | \fBatoi\fR(), except that they convert the initial portion of the | |
fea681da | 60 | string to their return type of \fIlong\fP or \fIlong long\fP. |
63aa9df0 | 61 | \fBatoq\fP() is an obsolete name for \fBatoll\fP(). |
fea681da MK |
62 | .SH "RETURN VALUE" |
63 | The converted value. | |
64 | .SH "CONFORMING TO" | |
68e1685c MK |
65 | SVr4, POSIX.1-2001, 4.3BSD, C99. |
66 | C89 and | |
67 | POSIX.1-1996 include the functions \fBatoi\fP() and \fBatol\fP() only. | |
68 | .BR atoq (3) | |
69 | is a GNU extension. | |
fea681da | 70 | .SH NOTES |
63aa9df0 | 71 | The non-standard \fBatoq\fP() function is not present in libc 4.6.27 |
fea681da MK |
72 | or glibc 2, but is present in libc5 and libc 4.7 (though only as an |
73 | inline function in \fB<stdlib.h>\fP until libc 5.4.44). The | |
63aa9df0 | 74 | \fBatoll\fP() function is present in glibc 2 since version 2.0.2, but |
fea681da MK |
75 | not in libc4 or libc5. |
76 | .SH "SEE ALSO" | |
77 | .BR atof (3), | |
78 | .BR strtod (3), | |
79 | .BR strtol (3), | |
80 | .BR strtoul (3) |