.\" 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. .\" .\" 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. .\" .\" @(#)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 .\" .TH FFLUSH 3 1993-11-29 "BSD MANPAGE" "Linux Programmer's Manual" .SH NAME fflush \- 刷新一個流 .SH "SYNOPSIS 總覽" .B #include .sp .BI "int fflush(FILE *" stream ); .SH "DESCRIPTION 描述" 函數 .B fflush 強制在所給的輸出流或更新流 .I stream 上,寫入在使用者空間緩沖的所有數據,使用流的底層寫功能函數。流的打開狀態不受影響。 .PP 如果參數 .I stream 是 .BR NULL , .B fflush 刷新 .I 所有 打開的流。 .PP 要使用非鎖定的對應版本,參見 .BR unlocked_stdio (3) 。 .SH "RETURN VALUE 返回值" 成功執行返回 0,否則返回 .B EOF 並設置全局變量 .I errno 來指示錯誤發生。 .SH ERRORS .TP .B EBADF .I Stream 不是一個打開的流,或者不是用於輸出。 .PP 函數 .B fflush 也可能失敗並置 .I errno 為 .BR write (2) 指定的值。 .SH "NOTES 要點" 注意 .B fflush() 僅僅刷新使用者空間的由 C 庫提供的緩沖。要保証數據被物理地存儲到磁碟上,必須也刷新核心緩沖。例如,使用 .BR sync (2) 或 .BR fsync (2). .SH "CONFORMING TO 標準參考" 函數 .BR fflush() 遵循 ANSI X3.159-1989 (``ANSI C'') 標準。 .SH "SEE ALSO 參見" .BR fsync (2), .BR sync (2), .BR write (2), .BR fclose (3), .BR fopen (3), .BR setbuf (3), .BR unlocked_stdio (3)