Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: hitchens@okfest.unt.dec.com (Francis J. Hitchens)
Subject: fdopen differences between osf 1.3 and 3.0
Date: Fri, 13 Jan 1995 11:51:16 GMT	[thread overview]
Message-ID: <1995Jan13.115116.6928@janix.mfr.dec.com> (raw)


Hi,

We have noticed the following difference between osf 1.3 and 3.0.

Under osf 3.0 when file descriptor 1 is mapped to a stream using 
fdopen, exiting the program no longer causes the new stream buffer 
to be flushed when writing stdout to a file or a pipe.

Under osf 1.3 the stream opened with fdopen is flushed under all
circumstances.

e.g for osf 3.0

$ prog < junk 			# produces output
$ prog < junk | wc		# produces no output
$ prog < junk > /dev/tty 	# produces output
$ prog < junk > junk2 		# produces empty file

The following small example illustrates the problem

#include <stdio.h>

int
main()
{
  FILE *in, *out;
  int c;

  if((in = fdopen(0, "rb")) == NULL) perror("opening in");

  if((out = fdopen(1, "wb")) ==NULL) perror("opening out");

  while((c = getc(in)) != EOF) putc(c, out);

/*  
  fflush(out);  Must call either of these under osf 3.0 to get output
  fclose(out);  written to a file or a pipe.
 */
}

Is this a bug or a feature ?

regards Francis J. Hitchens




                 reply	other threads:[~1995-01-13 11:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox