.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" %%%LICENSE_START(VERBATIM) .\" 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. .\" %%%LICENSE_END .\" .\" 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 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1996 Kentaro OGAWA .\" all rights reserved. .\" Translated Sat, 13 Jul 1996 22:47:32 +0900 .\" by Kentaro OGAWA .\" Updated Tue 30 Jan 2001 JST by Kentaro Shirakata .\" .TH ATOI 3 2020\-08\-13 GNU "Linux Programmer's Manual" .SH 名前 atoi, atol, atoll \- 文字列を整数型に変換する .SH 書式 .nf \fB#include \fP .PP \fBint atoi(const char *\fP\fInptr\fP\fB);\fP \fBlong atol(const char *\fP\fInptr\fP\fB);\fP \fBlong long atoll(const char *\fP\fInptr\fP\fB);\fP .fi .PP .RS -4 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .RE .PP .ad l \fBatoll\fP(): .RS 4 _ISOC99_SOURCE || || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE .RE .ad .SH 説明 \fBatoi\fP() 関数は、\fInptr\fP によって指示される文字列のはじめの部分を \fIint\fP 型整数に変換する。 この振る舞いは、 \fBatoi\fP() 関数がエラーを見つけない点以外は、 .PP .in +4n .EX strtol(nptr, NULL, 10); .EE .in .PP と同じである。 .PP \fBatol\fP() 関数と \fBatoll\fP() 関数は \fBatoi\fP() と同様の振る舞いをするが、 文字列のはじめの部分をそれぞれ \fIlong\fP や \fIlong long\fP に変換する。 .SH 返り値 The converted value or 0 on error. .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lbw23 lb lb l l l. インターフェース 属性 値 T{ \fBatoi\fP(), \fBatol\fP(), \fBatoll\fP() T} Thread safety MT\-Safe locale .TE .SH 準拠 .\" .SH NOTES .\" Linux libc provided .\" .BR atoq () .\" as an obsolete name for .\" .BR atoll (); .\" .BR atoq () .\" is not provided by glibc. .\" The .\" .BR atoll () .\" function is present in glibc 2 since version 2.0.2, but .\" not in libc4 or libc5. POSIX.1\-2001, POSIX.1\-2008, C99, SVr4, 4.3BSD. C89 と POSIX.1\-1996 には \fBatoi\fP() と \fBatol\fP() だけが含まれている。 .SH 注意 POSIX.1 leaves the return value of \fBatoi\fP() on error unspecified. On glibc, musl libc, and uClibc, 0 is returned on error. .SH バグ \fIerrno\fP is not set on error so there is no way to distinguish between 0 as an error and as the converted value. No checks for overflow or underflow are done. Only base\-10 input can be converted. It is recommended to instead use the \fBstrtol\fP() and \fBstrtoul\fP() family of functions in new programs. .SH 関連項目 \fBatof\fP(3), \fBstrtod\fP(3), \fBstrtol\fP(3), \fBstrtoul\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。