#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main () {
char buff[1024];
memset( buff, '/0', sizeof( buff ));
fprintf(stdout, "Going to set full buffering on/n");
setvbuf(stdout, buff, _IOFBF, 1024);
fprintf(stdout, "This is yiibai.com/n");
fprintf(stdout, "This output will go into buff/n");
fflush( stdout );
fprintf(stdout, "and this will appear when programm/n");
fprintf(stdout, "will come after sleeping 5 seconds/n");
sleep(5);
return(0);
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265220.html