.\" Copyright (c) 1990, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Chris Torek and the American National Standards Committee X3, .\" on Information Processing Systems. .\" .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" %%%LICENSE_END .\" .\" @(#)fflush.3 5.4 (Berkeley) 6/29/91 .\" .\" Converted for Linux, Mon Nov 29 15:22:01 1993, faith@cs.unc.edu .\" .\" Modified 2000-07-22 by Nicolás Lichtmaier .\" Modified 2001-10-16 by John Levon .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997-2000 YOSHINO Takashi and NAKANO Takeo .\" all rights reserved. .\" Translated 1997-02-13,YOSHINO Takashi .\" Update & Modified 1999-03-01, NAKANO Takeo .\" Update & Modified 2000-09-21, NAKANO Takeo .\" Updated 2001-11-02, Kentaro Shirakata .\" Updated 2010-04-10, Akihiro MOTOKI , LDP v3.24 .\" .TH FFLUSH 3 2015\-02\-01 GNU "Linux Programmer's Manual" .SH 名前 fflush \- ストリームの内容を強制的に出力(フラッシュ)する .SH 書式 \fB#include \fP .sp \fBint fflush(FILE *\fP\fIstream\fP\fB);\fP .SH 説明 出力ストリームに関しては、 \fBfflush\fP() は、ユーザー空間でバッファーリングされているすべてのデータを 指定された出力に書き出す (フラッシュする)、 もしくはストリーム \fIstream\fP の下位にある書き込み関数を用いてこのストリームを更新する。 seek 可能なファイルに関連付けられた入力ストリーム (ディスクファイルは seek 可能だが、 パイプや端末は seek できない) に関しては、 \fBfflush\fP() は、対応するファイルから取得されたが、アプリケーションからは 読み出されていないバッファーデータを全て破棄する。 ストリームは開いた状態のままであり、 この関数によって何の影響も受けない。 .PP .\" mtk: POSIX specifies that only output streams are flushed for this case. .\" Also verified for glibc by experiment. \fIstream\fP 引数が NULL ならば、 \fBfflush\fP() は開いている\fIすべての\fP出力ストリームをフラッシュする。 .PP これらの処理をロックせずに行いたいときは、 \fBunlocked_stdio\fP(3) を参照のこと。 .SH 返り値 成功すると 0 が返される。 その他の場合には \fBEOF\fP が返され、 \fIerrno\fP が、エラーに対応した値に設定される。 .SH エラー .TP \fBEBADF\fP \fIstream\fP は開いているストリームではない。 あるいはストリームは書き込み用ではない。 .PP \fBfflush\fP() 関数は \fBwrite\fP(2) に関して規定されているエラーで失敗することもある。 この場合 \fIerrno\fP もその値に設定される。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" 関数 \fBfflush\fP() はスレッドセーフである。 .SH 準拠 C89, C99, POSIX.1\-2001, POSIX.1\-2008. POSIX.1\-2001 では入力ストリームのフラッシュの動作は規定されていなかったが、 POSIX.1\-2008 では規定されている。 .SH 注意 \fBfflush\fP() は、 C ライブラリが与えているユーザー空間のバッファーしかフラッシュしない。 データが物理的にディスクに保存されることを保証したければ、 カーネルバッファーもフラッシュしなければならない。 これには例えば \fBsync\fP(2) や \fBfsync\fP(2) を用いる。 .SH 関連項目 \fBfsync\fP(2), \fBsync\fP(2), \fBwrite\fP(2), \fBfclose\fP(3), \fBfopen\fP(3), \fBsetbuf\fP(3), \fBunlocked_stdio\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。