缓冲输出

使用setbuf,将输出缓冲。我们可以自己设置缓冲区的大小。

当缓冲区满了,或者我们自己调用fflush()时,才会输出。

参考代码

#include<stdio.h>
#include<windows.h>
char buf[BUFSIZ];
int main()
{
 memset(buf,0,BUFSIZ);
 setbuf(stdout,buf);
 printf("hello");
 Sleep(3000);
 fflush(stdout);
 return 0;
}

你可能感兴趣的:(缓冲输出)