setlinebuf
函数功能: 设置文件流为线性缓冲区
相关函数: setbuffer,setbuf,setvbuf
表头文件: #include<stdio.h>
定义函数: void setlinebuf(FILE * stream);
函数说明: setlinebuf()用来设置文件流以换行为依据的缓冲IO,即行缓冲。
相当于调用setvbuf(stream,(char * )NULL,_IOLBF,0);请参考setvbuf()。
返回值: 无
程序例:
#include <stdio.h>
int main(void)
{
FILE *input;
output = fopen("file.out", "w");
/* set up output stream for line buffering using space that
will be obtained through an indirect call to malloc */
setlinebuf(output);
/* perform file I/O here */
/* close files */
fclose(output);
return 0;
}