When does the buffer flush

For cpp, I know that we have three cases to flush the buffer:

  1. When we get std::cin
  2. When we std::cout<<std::endl (or ohters things like endl)
  3. When we call some function like fflush

If I am right, there is a question:
If I just write std::cout<<"hello world"; in main and run it, I could see “hello world” at the console. So, by whom and when does the buffer flush? By the compiler?


Source: c++

Leave a Reply