c语言 关于一个函数

来源:百度知道 编辑:UC知道 时间:2024/05/21 06:26:41
我想问下 fflush(studio);括号里面应该是什么!
今天我们老师说他的功能主要是清除gets带来的空格什么的
上课太着急了写的有点草现在看不懂了,谢谢哪里能告诉我!

看你括号里面的意思,我觉得应该是使用这个函数,是需要stdio.h这个头文件的;
但是fflush这个函数,需要的参数是一个结构体的指针;
fflush <stdio.h>
int fflush( FILE *stream );
Parameters
stream
Pointer to FILE structure
Libraries
All versions of the C run-time libraries.

Return Values
fflush returns 0 if the buffer was successfully flushed. The value 0 is also returned in cases in which the specified stream has no buffer or is open for reading only. A return value of EOF indicates an error.

Note If fflush returns EOF, data may have been lost due to a write failure. When setting up a critical error handler, it is safest to turn buffering off with the setvbuf function.
Remarks
The fflush function flushes a stream. If the file associated with stream is open for output, fflush writes to that file the contents of the buffer associated with the stream. If the stream is open for input, fflush clears the contents of the buffer. fflush negates the effect of any pri