I understand from here that if i were to output characters without flushing the buffer ( with endl
or cin
) they wouldn't appear on my console until the program ends.
So i tried to make an infinite loop:
for(;;)
{
std::cout << "a" << std::endl;
}
and the same without flushing the buffer:
for(;;)
{
std::cout << "a";
}
They both output forever a
, the only difference i can observe is that the latter version of code has some delay time before it starts outputting the letter. The first one starts immediately.
I was expecting the second one to output the chars only if there was a break
in the loop, and the program would be terminated.