There is also another great conversation here . This seems to be related to some of the ones mentioned in scohe001, however it is slightly different, so I will put it in my own answer.
In connection with the above answer, this is a post on this forum that talks about how the buffer is flushed depending on other surrounding code. The Std :: cout function is bound to other stream functions, and regular c libraries are bound as scohe001. Therefore, if something is called that it is bound, its buffer will be hidden until continued.
Do you compile this with gcc on Linux or run it in some windows? This post here from this forum above talks about specific OS functions and what sleep () from windows can cause a buffer reset. Otherwise, regular gcc-compiled C ++ code will not print the buffer using sleep (), so it will not encounter any other code that will clear the buffer before continuing.
These messages contain a lot of information, so I will refrain from copying and pasting it here, so please forgive me gods of steakovert.
I hope this information helps!
source share