delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/03/23/14:19:44

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: Binary Output
To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp)
Date: Mon, 23 Mar 92 10:39:07 PST
Mailer: Elm [revision: 66.25]
Status: O

With all this talk of binary stdout not working, I had to run some
tests myself.  I used the following program:

	#include <stdio.h>
	#include <fcntl.h>
	extern void setmode(int, int);

	int
	main()
	{
	    int i;

	    setmode(fileno(stdout), O_BINARY);
	    for (i = 0; i < 256; i++)
		printf("%c", i);
	    return 0;
	}

When I dump the output of this program to a file, I see that ALL bytes
are written correctly.  If I pipe the output to xd, I see that all
bytes are still written correctly.  However, if I let the output go to
the screen, the output stops after encoutering control-z.

So I guess you could say that binary stdout is broken, but it seems to
me that the only time you care about binary stdout is when you're
dumping it to a file or another program, and that works.
--
				Eric Backus
				ericb%hplsla AT hplabs DOT hp DOT com
				(206) 335-2495

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019