OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / man3 / atoi.3
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 .\" Japanese Version Copyright (c) 1996 Kentaro OGAWA
32 .\"         all rights reserved.
33 .\" Translated Sat, 13 Jul 1996 22:47:32 +0900
34 .\"         by Kentaro OGAWA <k_ogawa@oyna.cc.muroran-it.ac.jp>
35 .\" Updated Tue 30 Jan 2001 JST by Kentaro Shirakata <argrath@ub32.org>
36 .\"
37 .TH ATOI 3  2010-09-20 "GNU" "Linux Programmer's Manual"
38 .SH 名前
39 atoi, atol, atoll, atoq \- 文字列を整数型に変換する
40 .SH 書式
41 .nf
42 .B #include <stdlib.h>
43 .sp
44 .BI "int atoi(const char *" nptr );
45 .br
46 .BI "long atol(const char *" nptr );
47 .br
48 .BI "long long atoll(const char *" nptr );
49 .br
50 .BI "long long atoq(const char *" nptr );
51 .fi
52 .sp
53 .in -4n
54 glibc 向けの機能検査マクロの要件
55 .RB ( feature_test_macros (7)
56 参照):
57 .in
58 .sp
59 .ad l
60 .BR atoll ():
61 .RS 4
62 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
63 _POSIX_C_SOURCE\ >=\ 200112L;
64 .br
65 or
66 .I cc\ -std=c99
67 .RE
68 .ad
69 .SH 説明
70 .BR atoi ()
71 関数は、\fInptr\fP によって指示される文字列のはじめの部分を
72 .I int
73 型整数に変換する。
74 この振る舞いは、
75 .BR atoi ()
76 関数がエラーを見つけない点以外は、
77 .sp
78 .in +4n
79 strtol(nptr, (char **) NULL, 10);
80 .in
81 .sp
82 と同じである。
83 .PP
84 .BR atol ()
85 関数と
86 .BR atoll ()
87 関数は
88 .BR atoi ()
89 と同様の振る舞いをするが、
90 文字列のはじめの部分をそれぞれ \fIlong\fP や \fIlong long\fP に変換する。
91 .BR atoq ()
92
93 .BR atoll ()
94 の古い名前である。
95 .SH 返り値
96 変換された値。
97 .SH 準拠
98 SVr4, POSIX.1-2001, 4.3BSD, C99.
99 C89 と POSIX.1-1996 には
100 .BR atoi ()
101
102 .BR atol ()
103 だけが含まれている。
104 .BR atoq ()
105 は GNU による拡張である。
106 .SH 注意
107 非標準である
108 .BR atoq ()
109 関数は libc 4.6.27 や glibc 2 には含まれていないが、
110 libc5 と libc 4.7 には存在している (ただし libc 5.4.44 までは
111 \fI<stdlib.h>\fP のインライン関数のみである)。
112 .BR atoll ()
113 関数は glibc 2 のバージョン 2.0.2 から存在しているが、
114 libc4 や libc5 には存在しない。
115 .SH 関連項目
116 .BR atof (3),
117 .BR strtod (3),
118 .BR strtol (3),
119 .BR strtoul (3)