futzing with stdout flushing solutions
This commit is contained in:
parent
90e101db98
commit
e026dabefb
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
gowrikumar/00-sizeof
|
||||
gowrikumar/02-dowhile
|
||||
gowrikumar/03-stdoutbuf
|
||||
gowrikumar/03b-stdoutbuf
|
||||
gowrikumar/03c-stdoutbuf
|
||||
|
23
gowrikumar/03b-stdoutbuf.c
Normal file
23
gowrikumar/03b-stdoutbuf.c
Normal 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
|
||||
*/
|
24
gowrikumar/03c-stdoutbuf.c
Normal file
24
gowrikumar/03c-stdoutbuf.c
Normal 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
|
||||
*/
|
Loading…
Reference in New Issue
Block a user