this post was submitted on 05 Apr 2025
138 points (88.3% liked)
Programmer Humor
22245 readers
768 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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
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
I remember having to
fflush
a couple of times.