I have just learned about stream buffering in C. As I understand, printf()
in C is buffered and it only prints when it hits a new line, the buffer is full or when we flush stdout
manually. Then I try these lines of code:
#include <stdio.h>
int main() {
printf("Hello world");
while(1);
}
Theoretically, the console will be received nothing, since Hello world
is still in the buffer. But for some reasons, my console still show this string. Why is it like that?
EDIT: I am using the command prompt in Windows 10.