You must log in or register to comment.
Simple.
\n
when you just want a newline.
endl
when you need to flush at the moment.Useful in case you are printing a debug output right before some function that might do bed stuff to buffers.
Edit: I wrote
println
instead ofendl
somehow. Guess I need more downtimeI only program in C. I was under the assumption that \n also flushes
I remember having to
fflush
a couple of times.It depends on whether you are printing to a terminal or to a file (and yes the terminal is also a file), and even then you can control the flushing behaviour using something like
unbuffer