2 * This program proves the behaivor of buffered, line-buffered
3 * and unbufferd I/O. Read the comments to understand it.
16 * stdout is line-buffered, it means the that data is flushed
17 * when a new-line char is found. So, you should see the line
20 fprintf(stdout
, "stdout is line-buffered\n");
22 /* ... and you shouldn't see the next line */
23 fprintf(stdout
, "--- The hidden line ---");
25 /* stderr is unbuffered, you will see the line */
26 fprintf(stderr
, "this is stderr in action");
29 * opens a file and write-data in it. When we call pause()
30 * you'll see that nothing was written to the file.
32 file
= fopen("./buf_test.txt", "w+");
34 fprintf(file
, "File contents\nFully buffered\n");