futzing with stdout flushing solutions

This commit is contained in:
Dan Buch 2011-06-16 21:33:57 -04:00
parent 90e101db98
commit e026dabefb
3 changed files with 49 additions and 0 deletions

2
.gitignore vendored
View File

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

View File

@ -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
*/

View File

@ -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
*/