4 ms·
I'm in the habit of using doing a setbuf(stdout,NULL) in the beginning of all my console apps, anyway. Buffered console I/O is something that made sense 20 yea
by CamperBob 17y ago
I'm in the habit of using doing a setbuf(stdout,NULL) in the beginning of all my console apps, anyway. Buffered console I/O is something that made sense 20 years ago but certainly not anymore.
If you did a setbuf(stderr,NULL) as well as setbuf(stdout,NULL), you'd achieve the same effect that the author's going for, with no need to remember to flush.
- nitrogen 17y agoIt really depends on how much data you need to write to stdout. If you're writing a single character at a time with no buffering, many terminal programs (GNOME terminal, etc.) will struggle to put out more than a few dozen lines per second, which can significantly slow down your program (I've known people who redirect their cc's stdout to /dev/null to avoid terminal latency slowing the build).