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

Christopher James Lahey clahey at ximian.com
Thu Aug 8 20:40:33 EST 2002


On Thu, 2002-08-08 at 17:10, Laurel Fan wrote:
> On Thu, Aug 08, 2002 at 01:57:10PM -0700, Akkana wrote:
> > The reason a newline flushes the output buffer on stdout and stderr
> > (at least on most systems) is that those those streams are line
> > buffered.
> 
> That's strange.  stderr on my system is unbuffered, unless there's
> something wrong with this code:
> 
> #include <stdio.h>
> 
> int main()
> {
>    fprintf(stderr, "stderr is unbuffered");
>    sleep(60);
> }

Might it be line buffered?  What happens if you put a \n at the end of
the string?
  Chris





More information about the Courses mailing list