mirror of https://github.com/mkerrisk/man-pages
79 lines
2.8 KiB
Groff
79 lines
2.8 KiB
Groff
|
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
|
||
|
.\"
|
||
|
.\" Permission is granted to make and distribute verbatim copies of this
|
||
|
.\" manual provided the copyright notice and this permission notice are
|
||
|
.\" preserved on all copies.
|
||
|
.\"
|
||
|
.\" Permission is granted to copy and distribute modified versions of this
|
||
|
.\" manual under the conditions for verbatim copying, provided that the
|
||
|
.\" entire resulting derived work is distributed under the terms of a
|
||
|
.\" permission notice identical to this one.
|
||
|
.\"
|
||
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
||
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
||
|
.\" responsibility for errors or omissions, or for damages resulting from
|
||
|
.\" the use of the information contained herein. The author(s) may not
|
||
|
.\" have taken the same level of care in the production of this manual,
|
||
|
.\" which is licensed free of charge, as they might when working
|
||
|
.\" professionally.
|
||
|
.\"
|
||
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||
|
.\" the source, must acknowledge the copyright and authors of this work.
|
||
|
.\"
|
||
|
.\" References consulted:
|
||
|
.\" Linux libc source code
|
||
|
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
|
||
|
.\" 386BSD man pages
|
||
|
.\" Modified Mon Mar 29 22:39:41 1993, David Metcalfe
|
||
|
.\" Modified Sat Jul 24 21:38:42 1993, Rik Faith (faith@cs.unc.edu)
|
||
|
.\" Modified Sun Dec 17 18:35:06 2000, Joseph S. Myers
|
||
|
.\"
|
||
|
.TH ATOI 3 2000-12-17 "GNU" "Linux Programmer's Manual"
|
||
|
.SH NAME
|
||
|
atoi, atol, atoll, atoq \- convert a string to an integer
|
||
|
.SH SYNOPSIS
|
||
|
.nf
|
||
|
.B #include <stdlib.h>
|
||
|
.sp
|
||
|
.BI "int atoi(const char *" nptr );
|
||
|
.br
|
||
|
.BI "long atol(const char *" nptr );
|
||
|
.br
|
||
|
.BI "long long atoll(const char *" nptr );
|
||
|
.br
|
||
|
.BI "long long atoq(const char *" nptr );
|
||
|
.fi
|
||
|
.SH DESCRIPTION
|
||
|
The \fBatoi()\fP function converts the initial portion of the string
|
||
|
pointed to by \fInptr\fP to
|
||
|
.IR int .
|
||
|
The behaviour is the same as
|
||
|
.sp
|
||
|
.RS
|
||
|
.B strtol(nptr, (char **)NULL, 10);
|
||
|
.RE
|
||
|
.sp
|
||
|
except that \fBatoi()\fP does not detect errors.
|
||
|
.PP
|
||
|
The \fBatol()\fP and \fBatoll()\fP functions behave the same as
|
||
|
\fBatoi()\fR, except that they convert the initial portion of the
|
||
|
string to their return type of \fIlong\fP or \fIlong long\fP.
|
||
|
\fBatoq()\fP is an obsolete name for \fBatoll()\fP.
|
||
|
.SH "RETURN VALUE"
|
||
|
The converted value.
|
||
|
.SH "CONFORMING TO"
|
||
|
SVID 3, POSIX.1, BSD 4.3, ISO/IEC 9899. ISO/IEC 9899:1990 (C89) and
|
||
|
POSIX.1 (1996 edition) include the functions \fBatoi()\fP and
|
||
|
\fBatol()\fP only; C99 adds the function \fBatoll()\fP.
|
||
|
.SH NOTES
|
||
|
The non-standard \fBatoq()\fP function is not present in libc 4.6.27
|
||
|
or glibc 2, but is present in libc5 and libc 4.7 (though only as an
|
||
|
inline function in \fB<stdlib.h>\fP until libc 5.4.44). The
|
||
|
\fBatoll()\fP function is present in glibc 2 since version 2.0.2, but
|
||
|
not in libc4 or libc5.
|
||
|
.SH "SEE ALSO"
|
||
|
.BR atof (3),
|
||
|
.BR strtod (3),
|
||
|
.BR strtol (3),
|
||
|
.BR strtoul (3)
|