fflush 中文man页面

系统
函数 fflush 强制在所给的输出流或更新流 stream 上,写入在用户空间缓冲的所有数据,使用流的底层写功能函数。流的打开状态不受影响。

NAME

fflush - 刷新一个流  

SYNOPSIS 总览

#include <stdio.h>

int fflush(FILE *stream);  

DESCRIPTION 描述

函数 fflush 强制在所给的输出流或更新流 stream 上,写入在用户空间缓冲的所有数据,使用流的底层写功能函数。流的打开状态不受影响。

如果参数 streamNULL, fflush 刷新 所有 打开的流。

要使用非锁定的对应版本,参见 unlocked_stdio(3) 。  

RETURN VALUE 返回值

成功执行返回 0,否则返回 EOF 并设置全局变量 errno 来指示错误发生。  

ERRORS

EBADF
Stream 不是一个打开的流,或者不是用于输出。

函数 fflush 也可能失败并置 errnowrite(2) 指定的值。  

NOTES 要点

注意 fflush() 仅仅刷新用户空间的由 C 库提供的缓冲。要保证数据被物理地存储到磁盘上,必须也刷新内核缓冲。例如,使用 sync(2) 或 fsync(2).  

CONFORMING TO 标准参考

函数 fflush() 遵循 ANSI X3.159-1989 (``ANSI C'') 标准。  

SEE ALSO 参见

fsync(2), sync(2), write(2), fclose(3), fopen(3), setbuf(3), unlocked_stdio(3)

#p#

NAME

fflush - flush a stream  

SYNOPSIS

#include <stdio.h>

int fflush(FILE *stream);  

DESCRIPTION

The function fflush forces a write of all user-space buffered data for the given output or update stream via the stream's underlying write function. The open status of the stream is unaffected.

If the stream argument is NULL, fflush flushes all open output streams.

For a non-locking counterpart, see unlocked_stdio(3).  

RETURN VALUE

Upon successful completion 0 is returned. Otherwise, EOF is returned and the global variable errno is set to indicate the error.  

ERRORS

EBADF
Stream is not an open stream, or is not open for writing.

The function fflush may also fail and set errno for any of the errors specified for the routine write(2).  

NOTES

Note that fflush() only flushes the user space buffers provided by the C library. To ensure that the data is physically stored on disk the kernel buffers must be flushed too, e.g. with sync(2) or fsync(2).  

CONFORMING TO

The function fflush() conforms to ANSI X3.159-1989 (``ANSI C'').  

SEE ALSO

fsync(2), sync(2), write(2), fclose(3), fopen(3), setbuf(3), unlocked_stdio(3)

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:39:42

fcloseall中文man

2011-08-25 15:00:15

cfgetispeed中文man

2011-08-19 18:35:50

issue中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 17:40:25

setvbuf中文man

2011-08-23 14:21:16

poweroff中文man

2011-08-24 15:52:59

intro中文man

2011-08-23 13:40:31

2011-08-25 15:54:08

ferror中文man

2011-08-25 17:24:54

puts中文man

2011-08-25 18:34:55

ungetc中文man

2011-08-23 10:03:40

useradd中文man

2011-08-23 10:29:02

chpasswd中文man

2011-08-23 10:34:22

convertquot中文man

2011-08-23 15:39:34

rpmbuild中文man

2011-08-24 15:48:38

INSERT中文man
点赞
收藏

51CTO技术栈公众号