[Courses] Re: [C] A clarification on fflush(stderr)

Malcolm-Rannirl rannirl-lc at otherkin.net
Thu Aug 8 09:57:53 EST 2002


On Thursday 08 August 2002 09:13 am, Anand R wrote:

> Thanks Laura. Which means I can safely assume that flushing stderr is a
> programming best practice.

Oddly enough, it helps if you read the man page. (Finding which one required 
google however :)) Which is what I should have done to start with.

man stdio reads, in part:

"When opened, the standard error stream is not fully buffered; the standard 
input and output streams are fully buffered if and only if the streams do not 
to refer to an interactive device."

Now "not fully buffered" is somewhat unclear and does not seem to mean 
completely unbuffered, though it might (thus flushing may be appropriate). 
It's possible it means line buffered (which means fprintf(stderr, "foo\n") 
would be fine, but fprintf(stderr, ".") would not).


> From: Laura Bowser [mailto:lbowser at andrew.cmu.edu] wrote:
>
> Another *really* useful use for fflush is when you're trying to debug a
> program which segfaults.

I thought that was part of the point I made, maybe it wasn't clear. (I'm 
trying to improve my tech writing ability but it's slow going, as I still 
assume way too many things are "obvious").


-- 
Be careful what you want.
It might want you.
- 'the Dragon' Elvendrums

<<------------------------------------------------------------------>>
<<  This email is monitored by the US government under the auspice  >>
<< of the USA act. For private communication, ask me for my PGP key >>
<< ----- PGP: envelopes for email - www.pgp.com www.gnupg.org ----- >>



More information about the Courses mailing list