setvbuf/setlinebuf issue

Christopher Faylor cgf-rcm@cygwin.com
Tue Sep 16 20:04:00 GMT 2003


On Tue, Sep 16, 2003 at 12:13:31PM -0700, Jan Jaeger wrote:
>We have always used setvbuf(stdout, NULL, _IOLBF, 0) to ensure that
>each line is read by the logger as it is written.
>
>However this has now stopped working in the current release of cygwin,
>adding a fflush() after every printf() bypasses the error, but at the
>moment setvbuf does not seem to work correctly for us.

Do you have a simple test case which demonstrates this?  I wrote the
below and piped it into cat and it works as expected.  "foo" is printed,
there is a five second pause, and "bar is printed.

cgf

#include <stdio.h>
int
main (int argc, char **argv)
{
  setvbuf(stdout, NULL, _IOLBF, 0);
  printf ("foo\n");
  sleep (5);
  printf ("bar");
}
--
Please use the resources at cygwin.com rather than sending personal email.
Special for spam email harvesters: send email to aaaspam@sourceware.org
and be permanently blocked from mailing lists at sources.redhat.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list