fflush()和 stdin分别是什么意思,fflush(stdin)是什么意思
时间:2008-07-25 22:37:05
来源:论坛整理 作者: 编辑:chinaitzhe
网友回复:stdin是默认的输入流文件,对应输入缓冲区
fflush(stdin)的作用就是清空输入缓冲区,避免缓冲区内残存读取函数无法取走的内容!
清空输入缓冲
当输入语句太多 用这个可以避免一些错误
当输出语句太多 用:fflush(stdout)
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).
网友回复:清空标准输入缓冲区,stdin 是标准输入缓冲区,似乎是个全局变量,C语言里
网友回复:清空输入缓冲区
网友回复:清空缓冲
stdin是文件指针,FILE *stdin,代表标准输入
关键字:fflush,stdin,意思,fflush,stdin,
上一篇:使用DJGPP的一个问题
下一篇:下面没有链接了











文章评论
共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面