On 6/12/2013 5:30 AM, Andrei Alexandrescu wrote:
On 6/11/13 11:42 PM, Walter Bright wrote:
I think you meant "just flush once after using the FILE * for the
first time"

I think it's a bad idea, it'll muck up the buffering (i.e. make it slower).

The fix is when main() returns to do the flush there.

I agree. One question is, should we flush all buffers upon termination?
fflush(null) would do so.
http://www.gnu.org/software/libc/manual/html_node/Flushing-Buffers.html

I haven't heard about the fflush(null) thing. That may be gnu-specific. I don't think that works on Windows.

But yes, all open files should be flushed on termination. It's what C's stdio does already.

Reply via email to