Message from C, C++ talks

June 2019

— Call cout.flush();

— But from what I remember I didn't need to do that for the text to be output to the console. What am I not getting here?

Message permanent page

— You don't need to do it when

1. you use endl
2. The internal buffer of cout is full
3. The code/program leaves scope of cout (end of program)

In all three cases a flush is implicitly done

Message permanent page

— I don't know what you are not getting 😅


So if I used a cout in the middle of a program without an endl, there is no way the text would show up unless I filled the buffer (which I assume isn't that small)?

— If you need to flush, use std::flush

— True

— In order for new programmers to understand what you do

— I think I get what I did't get now. :P

— Apparently reading from cin flushes the buffer. That's what confused me.

— Anyone has c++ pdf that I can download?

— The internet ;)

— Have your tried Amazon? 😄

— #cppbook

— /notes