futzing with stdout flushing solutions

cat-town
Dan Buch 14 years ago
parent 90e101db98
commit e026dabefb

2
.gitignore vendored

@ -1,3 +1,5 @@
gowrikumar/00-sizeof
gowrikumar/02-dowhile
gowrikumar/03-stdoutbuf
gowrikumar/03b-stdoutbuf
gowrikumar/03c-stdoutbuf

@ -0,0 +1,23 @@
/**
* :author: Dan Buch (daniel.buch@gmail.com)
*/
#include <stdio.h>
#include <unistd.h>
int main()
{
printf("This time we'll include \\n!\n");
printf("(Hit ^C to stop the madness.)\n");
while(1)
{
fprintf(stdout, "hello-out\n");
fprintf(stderr, "hello-err\n");
sleep(1);
}
return 0;
}
/* vim:filetype=c:fileencoding=utf-8
*/

@ -0,0 +1,24 @@
/**
* :author: Dan Buch (daniel.buch@gmail.com)
*/
#include <stdio.h>
#include <unistd.h>
int main()
{
printf("This time we'll flush stdout!\n");
printf("(Hit ^C to stop the madness.)\n");
while(1)
{
fprintf(stdout, "hello-out ");
fprintf(stderr, "hello-err ");
fflush(stdout);
sleep(1);
}
return 0;
}
/* vim:filetype=c:fileencoding=utf-8
*/
Loading…
Cancel
Save