1 .\" Copyright (c) 1990, 1991 Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)stdio.3 6.5 (Berkeley) 5/6/91
34 .\" Converted for Linux, Mon Nov 29 16:07:22 1993, faith@cs.unc.edu
35 .\" Modified, 2001-12-26, aeb
37 .\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
38 .\" all rights reserved.
39 .\" Translated Mon Jan 20 23:06:18 JST 1997
40 .\" by YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
41 .\" Updated & Modified Thu Feb 14 21:39:49 JST 2002
42 .\" by Yuichi SATO <ysato@h4.dion.ne.jp>
43 .\" Updated & Modified Sun Sep 7 14:36:19 JST 2003
44 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
45 .\" Updated & Modified Sat Jan 17 03:18:29 JST 2004 by Yuichi SATO
47 .\"WORD: position indicator 位置指示子
48 .\"WORD: positioning requests 位置指定リクエスト
50 .TH STDIO 3 2001-12-26 "" "Linux Programmer's Manual"
53 .\"O stdio \- standard input/output library functions
66 .\"O The standard I/O library provides a simple and efficient buffered stream
68 標準入出力ライブラリは、簡単かつ効果のよい、
69 バッファリングされたストリーム入出力インターフェースを提供する。
70 .\"O Input and output is mapped into logical data streams and the
71 .\"O physical I/O characteristics are concealed.
72 入力と出力は論理データストリームに割り付けられ、
74 .\"O The functions and macros are
75 .\"O listed below; more information is available from the individual man pages.
76 このライブラリに属する関数とマクロを以下に挙げる。
77 より詳しい情報は個々の man ページから得ることができる。
79 .\"O A stream is associated with an external file (which may be a physical
82 .\"O a file, which may involve creating a new file.
83 .\"O Creating an existing file
84 .\"O causes its former contents to be discarded.
88 ストリームは外部ファイル (通常は物理デバイス) に連結される。
89 この操作には新しくファイルを作成することも含まれる。
90 既存のファイルと同じ名前のファイルを新たに作ると、
92 .\"O If a file can support
93 .\"O positioning requests (such as a disk file, as opposed to a terminal) then a
94 .\"O .I file position indicator
95 .\"O associated with the stream is positioned at the start of the file (byte
96 .\"O zero), unless the file is opened with append mode.
97 ファイルが位置指定リクエストをサポートしている
98 (ディスクファイルなどが相当する。逆の例としては端末が挙げられる) 場合、
100 .I ファイル位置指示子 (file position indicator)
101 は、追加モードで開かれない限りファイルの先頭 (0 バイト目) に位置する。
102 .\"O If append mode is used,
103 .\"O it is unspecified whether the position indicator will be placed at the
104 .\"O start or the end of the file.
106 位置指示子をファイルの先頭に置かれるか末尾に置かれるかは規定されていない。
107 .\"O The position indicator is maintained by
108 .\"O subsequent reads, writes and positioning requests.
110 以降の読み書きや位置指定リクエストによって変更される。
111 .\"O All input occurs
112 .\"O as if the characters were read by successive calls to the
114 .\"O function; all output takes place as if all characters were written by
115 .\"O successive calls to the
120 関数を次々に呼び出して文字を読み込んだかのように行われる。
123 関数を次々に呼び出して文字を書き込んだかのように行われる。
125 .\"O A file is disassociated from a stream by
130 ことによって、そのファイルはストリームから切り離される。
131 .\"O Output streams are flushed (any unwritten buffer contents are
132 .\"O transferred to the host environment) before the stream is disassociated from
134 出力ストリームは、そのストリームがファイルから切り離される前にフラッシュされる
135 (書き込まれていないすべてのバッファの内容がホスト環境に転送される)。
136 .\"O The value of a pointer to a
138 .\"O object is indeterminate after a file is closed (garbage).
141 ファイルを閉じた後では不確定になる (ゴミになってしまう)。
143 .\"O A file may be subsequently reopened, by the same or another program
144 .\"O execution, and its contents reclaimed or modified (if it can be
145 .\"O repositioned at the start).
146 ファイルはその後 (同じまたは別のプログラムによって)
149 (そのファイルで先頭への位置移動が可能であれば)。
150 .\"O If the main function returns to its original caller, or the
152 .\"O function is called, all open files are closed
153 .\"O (hence all output streams are
154 .\"O flushed) before program termination.
155 main 関数がもとの呼び出し側に返ったり、
159 現在開いているすべてのファイルは閉じられる
160 (その結果、すべての出力ストリームはフラッシュされる)。
161 .\"O Other methods of program termination,
164 .\"O do not bother about closing files properly.
170 .\"O At program startup, three text streams are predefined and need not be
171 .\"O opened explicitly:
172 .\"O .I standard input
173 .\"O (for reading conventional input),
174 .\"O .I standard output
175 .\"O (for writing conventional input), and
176 .\"O .I standard error
177 .\"O (for writing diagnostic output).
178 プログラムの起動時に 3 個のテキストストリームが予め定義されており、
180 .I 標準入力 (standard input)
182 .I 標準出力 (standard output)
184 .I 標準エラー出力 (standard error)
186 .\"O These streams are abbreviated
187 .\"O .IR stdin , stdout
195 .\"O When opened, the standard error stream is not fully buffered; the standard
196 .\"O input and output streams are fully buffered if and only if the streams do
197 .\"O not to refer to an interactive device.
201 標準入力ストリームと標準出力ストリームは、
202 ストリームがインタラクティブなデバイスを参照していなければ、
205 .\"O Output streams that refer to terminal devices are always line buffered by
206 .\"O default; pending output to such streams is written automatically whenever
207 .\"O an input stream that refers to a terminal device is read.
209 デフォルトでは常に行単位でバッファリングされている。
210 ただしそのようなストリームにおけるバッファ内の出力は、
211 端末デバイスを参照している入力ストリームからの読み込みがあるたびに、
213 .\"O In cases where a
214 .\"O large amount of computation is done after printing part of a line on an
215 .\"O output terminal, it is necessary to
217 .\"O the standard output before going off and computing so that the output will
219 出力端末に行の一部を書き込んだ後で大量の計算を行う場合、
220 出力が表示されるように、計算に取りかかる前に標準出力に対して
226 .\"O library is a part of the library
228 .\"O and routines are automatically loaded as needed by the compilers
243 .\"O sections of the following manual pages indicate which include files are to
244 .\"O be used, what the compiler declaration for the function looks like and
245 .\"O which external variables are of interest.
246 後述する man ページ中の「書式」の節には、
247 どのインクルードファイルを使用しなければならないか、
248 その関数のコンパイラー宣言はどのようなものか、
249 どのような外部変数が関係するのかが示されている。
251 .\"O The following are defined as macros; these names may not be reused without
252 .\"O first removing their current definitions with
270 .\" Not on Linux: .BR fropen ,
271 .\" Not on Linux: .BR fwopen ,
283 で削除しない限り、再利用することはできない。
284 .\"O Function versions of the macro functions
294 .\"O exist and will be used if the macros definitions are explicitly removed.
296 マクロの定義が明示的に消去されている場合には、
298 .\"O .SS "List of Functions"
304 .\"O Function Description
307 .\"O clearerr check and reset stream status
308 .\"O fclose close a stream
309 .\"O fdopen stream open functions
310 .\"O feof check and reset stream status
311 .\"O ferror check and reset stream status
312 .\"O fflush flush a stream
313 clearerr ストリームの状態の確認とリセット
316 feof ストリームの状態の確認とリセット
317 ferror ストリームの状態の確認とリセット
319 .\"O fgetc get next character or word from input stream
320 .\"O fgetpos reposition a stream
321 .\"O fgets get a line from a stream
322 .\"O fileno return the integer descriptor of the argument stream
323 .\"O fopen stream open functions
324 .\"O fprintf formatted output conversion
325 .\"O fpurge flush a stream
326 .\"O fputc output a character or word to a stream
327 .\"O fputs output a line to a stream
328 .\"O fread binary stream input/output
329 .\"O freopen stream open functions
330 fgetc 次の文字または語を入力ストリームから獲得する
331 fgetpos ストリームの位置を取得する
334 fileno 引き数であるストリームの整数値のディスクリプタを返す
338 fputc 文字または語をストリームに出力する
342 .\"O fscanf input format conversion
343 .\"O fseek reposition a stream
344 .\"O fsetpos reposition a stream
345 .\"O ftell reposition a stream
346 .\"O fwrite binary stream input/output
347 .\"O getc get next character or word from input stream
348 .\"O getchar get next character or word from input stream
349 .\"O gets get a line from a stream
350 .\"O getw get next character or word from input stream
352 fseek ストリームの位置指示子を移動する
353 fsetpos ストリームの位置指示子を移動する
357 getc 次の文字または語を入力ストリームから取得する
358 getchar 次の文字または語を入力ストリームから取得する
360 getw 次の文字または語を入力ストリームから取得する
361 .\"O mktemp make temporary filename (unique)
362 .\"O perror system error messages
363 .\"O printf formatted output conversion
364 .\"O putc output a character or word to a stream
365 .\"O putchar output a character or word to a stream
366 .\"O puts output a line to a stream
367 .\"O putw output a character or word to a stream
368 .\"O remove remove directory entry
369 .\"O rewind reposition a stream
370 .\"O scanf input format conversion
371 mktemp 他と重ならないテンポラリファイル名を作る
374 putc 文字または語をストリームに出力する
375 putchar 文字または語をストリームに出力する
377 putw 文字または語をストリームに出力する
378 remove ディレクトリエントリを削除する
379 rewind ストリームの位置指示子を移動する
381 .\"O setbuf stream buffering operations
382 .\"O setbuffer stream buffering operations
383 .\"O setlinebuf stream buffering operations
384 .\"O setvbuf stream buffering operations
385 .\"O sprintf formatted output conversion
386 .\"O sscanf input format conversion
387 .\"O strerror system error messages
388 .\"O sys_errlist system error messages
389 .\"O sys_nerr system error messages
390 .\"O tempnam temporary file routines
391 .\"O tmpfile temporary file routines
392 .\"O tmpnam temporary file routines
393 .\"O ungetc un-get character from input stream
394 setbuf ストリームのバッファリングの操作
395 setbuffer ストリームのバッファリングの操作
396 setlinebuf ストリームのバッファリングの操作
397 setvbuf ストリームのバッファリングの操作
400 strerror システムエラーメッセージ
401 sys_errlist システムエラーメッセージ
402 sys_nerr システムエラーメッセージ
406 ungetc 入力ストリームへ 1 文字戻す。
407 .\"O vfprintf formatted output conversion
408 .\"O vfscanf input format conversion
409 .\"O vprintf formatted output conversion
410 .\"O vscanf input format conversion
411 .\"O vsprintf formatted output conversion
412 .\"O vsscanf input format conversion
420 .\"O .SH "CONFORMING TO"
424 .\"O library conforms to C89.
434 .BR unlocked_stdio (3)