Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* fdopen behaviour differece between 1.3 & 3.0
@ 1995-01-13 10:41 Francis J. Hitchens
  0 siblings, 0 replies; only message in thread
From: Francis J. Hitchens @ 1995-01-13 10:41 UTC (permalink / 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-01-13 10:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-01-13 10:41 fdopen behaviour differece between 1.3 & 3.0 Francis J. Hitchens

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