1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu)
25 .\" Japanese Version Copyright (c) 1997 IMAMURA Nobutaka
26 .\" all rights reserved.
27 .\" Translated 1997-02-14, IMAMURA Nobutaka <imamura@spp.hpc.fujitsu.co.jp>
28 .\" Updated 1999-08-29, Kentaro Shirakata <argrath@ub32.org>
29 .\" Updated 2001-11-02, Kentaro Shirakata <argrath@ub32.org>
30 .\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
32 .TH GETS 3 2011-09-28 "GNU" "Linux Programmer's Manual"
35 .\"O fgetc, fgets, getc, getchar, gets, ungetc \- input of characters and strings
36 fgetc, fgets, getc, getchar, gets, ungetc \- 文字と文字列の入力
42 .BI "int fgetc(FILE *" stream );
44 .BI "char *fgets(char *" "s" ", int " "size" ", FILE *" "stream" );
46 .BI "int getc(FILE *" stream );
48 .B "int getchar(void);"
50 .BI "char *gets(char *" "s" );
52 .BI "int ungetc(int " c ", FILE *" stream );
57 .\"O reads the next character from
59 .\"O and returns it as an
65 .\"O on end of file or error.
73 にキャストして返す。ファイルの終わりやエラーとなった場合は
80 .\"O except that it may be implemented as a macro which evaluates
88 を複数回評価するマクロとして実装されているかもしれない。
92 .\"O .BI "getc(" stdin ) \fR.
95 .BI "getc(" stdin ) \fR
99 .\"O reads a line from
101 .\"O into the buffer pointed to by
103 .\"O until either a terminating newline or
105 .\"O which it replaces with a null byte (\(aq\e0\(aq).
116 は NULL バイト (\(aq\e0\(aq) に置き換えられる)。
117 .\"O No check for buffer overrun is performed (see BUGS below).
118 バッファ・オーバーランのチェックは行われない (下記の「バグ」を参照)。
121 .\"O reads in at most one less than
125 .\"O and stores them into the buffer pointed to by
127 .\"O Reading stops after an
130 .\"O If a newline is read, it is stored into the buffer.
131 .\"O A terminating null byte (\(aq\e0\(aq)
132 .\"O is stored after the last character in the buffer.
143 読み込まれた改行文字はバッファに格納される。
144 終端の NULL バイト (\(aq\e0\(aq)
145 が一つバッファの中の最後の文字の後に書き込まれる。
153 .\"O .IR "unsigned char" ,
154 .\"O where it is available for subsequent read operations.
155 .\"O Pushed-back characters
156 .\"O will be returned in reverse order; only one pushback is guaranteed.
166 書き戻しとして保証されているのは、一文字だけである。
168 .\"O Calls to the functions described here can be mixed with each other and with
169 .\"O calls to other input functions from the
171 .\"O library for the same input stream.
174 ライブラリの入力関数を同じ入力ストリームに対して互いに混ぜて使うことができる。
176 .\"O For nonlocking counterparts, see
177 .\"O .BR unlocked_stdio (3).
178 これらの処理をロックせずに行いたいときは、
179 .BR unlocked_stdio (3)
181 .\"O .SH "RETURN VALUES"
187 .\"O return the character read as an
188 .\"O .I unsigned char
193 .\"O on end of file or error.
201 にキャストして返す。ファイルの終わりやエラーの場合は
210 .\"O on success, and NULL
211 .\"O on error or when end of file occurs while no characters have been read.
217 を返し、エラーや 1 文字も読み込んでいないのにファイルの終わりになった
232 .\"O .SH "CONFORMS TO"
234 C89, C99, POSIX.1-2001.
240 .\"O POSIX.1-2008 marks
250 .\"O Because it is impossible to tell without knowing the data in advance how many
253 .\"O will read, and because
255 .\"O will continue to store characters past the end of the buffer,
256 .\"O it is extremely dangerous to use.
257 .\"O It has been used to break computer security.
267 がバッファの終わりを越えて書き込み続けるため、
270 これを利用してコンピュータのセキュリティが破られてきた。
275 .\"O It is not advisable to mix calls to input functions from the
277 .\"O library with low-level calls to
279 .\"O for the file descriptor associated with the input stream; the results
280 .\"O will be undefined and very probably not what you want.
281 入力ストリームのファイルディスクリプタに対して、
283 ライブラリの入力関数と、低レベル呼び出しの
286 結果がどうなるかは分からず、おそらくあなたの
303 .BR unlocked_stdio (3)