Given the following code
#include <stdio.h>
int main()
{
while(1)
{
sleep(1);
printf("X");
}
return 0;
}
Exit nothing happens until the buffer is full and subsequently automatically flushed by the system.
Why is it not buffered in this situation ?:
#include <stdio.h>
int main()
{
while(1)
{
printf("X");
}
return 0;
}
The sleep () function seems to have some kind of hidden effect.
I am new to the concept of buffers, so any additional information or notes on my potential misconceptions are welcome.
source
share