setbuf 函数文档
函数概要:
setbuf 函数用于指定一个数据流的缓冲区。
函数原型:
#include <stdio.h> ... void setbuf(FILE *stream, char *buf);
参数解析:
|
参数 |
含义 |
|
stream |
该参数是一个 FILE 对象的指针,指定一个打开的数据流 |
|
buf |
指定一个用户分配的缓冲区,该缓冲区的长度最少需要是 BUFSIZ |
返回值:
该函数没有返回值。
演示:
#include <stdio.h>
int main(void)
{
char buf[BUFSIZ];
setbuf(stdin, buf);
printf("Hello, world!\n");
return 0;
}




