From: kramer@ai.toronto.edu (Bryan M Kramer)
Subject: Re: cout and output redirection
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 14 Sep 1992 09:22:58 GMT

|  -- using template mhl.format --
| Date:    Fri, 11 Sep 92 17:49:49 EDT
| To:      kramer@cs.toronto.edu (Bryan M Kramer)
| 
| From:    brendan@cygnus.com (Brendan Kehoe)
| Subject: cout and output redirection
| 
| Return-Path: relay.cs.toronto.edu!cygnus.com!brendan
| In-Reply-To: Bryan M Kramer's message of  Thu, 10 Sep 1992 15:00:48 -0400 <92Se
|      ***p10.150121edt.30@jarvis.csri.toronto.edu>
| References: <92Sep10.150121edt.30@jarvis.csri.toronto.edu>
| Reply-To: brendan@cygnus.com
| 
| Please send a copy of the program to bug-libg++@prep.ai.mit.edu.
| 
| --
| Brendan Kehoe                                               brendan@cygnus.com
| Cygnus Support, Palo Alto, CA                                  +1
415 322 3811

Here is a small test program that exhibits the behaviour I'm seeing.
I create it using 
make zzzz
(note that my libraries and includes are in unusual places)
Typing 
zzzz
results in
Hello World.
Typing
zzzz > /tmp/foo
results in an empty file.

=====================
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, use "sh file -c".
# If this archive is complete, you will see the following message at the end:
#		"End of shell archive."
#
# Contents:
#   Makefile common.h test.C
#
# Wrapped by kramer@ai.utoronto.ca on Mon Sep 14 10:04:34 1992
#
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f Makefile -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"Makefile\"
else
echo shar: Extracting \"Makefile\" \(625 characters\)
sed "s/^X//" >Makefile <<'END_OF_Makefile'
X
XKBHOME = .
X
XMPHOME = /homes/wotan/a/kramer/mp
XGPPCC = $(MPHOME)/bin/g++
XGPPFLAGS = -g -DALTGCC -finline-functions -I$(MPHOME)/lib/g++-include -I$(KBHOME)/include
XGPPLIBS = -L$(MPHOME)/lib -lg++ -L$(MPHOME)/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2 -lgcc -lm
XGCC = $(MPHOME)/bin/gcc
X
XXLIBS = -L/usr/openwin/lib -lxview -lolgx -lX11
XWOBJECTS = xview.o x.o
XKBOBJS = kblib.o extern.o
X
XPATH=$(MPHOME)/bin:/local/bin:/usr/bin:/bin:/usr/ucb/bin:$(MPHOME)/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2
X
XCOMMON = common.h
XHFILES = common.h object.h
XWINCLUDES = window.h grapher.h x.h
X
Xzzzz: test.C
X	$(GPPCC) $(GPPFLAGS) -o zzzz test.C $(GPPLIBS)
X
END_OF_Makefile
if test 625 -ne `wc -c <Makefile`; then
    echo shar: \"Makefile\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f common.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"common.h\"
else
echo shar: Extracting \"common.h\" \(1067 characters\)
sed "s/^X//" >common.h <<'END_OF_common.h'
X//  -*- C++ -*-.
X/*
X
X *	Author:		Bryan M. Kramer
X
X*/
X
X
X# ifndef COMMONH
X# define COMMONH
X
X
X
X# include	<string.h>
X#ifndef	ALTGCC
X# include	<stream.h>
X# else
X# include   	<iostream.h>
X# include   	<stdlib.h>
X#endif
X
X#   define EXTERN_FUNCTION( rtn, args ) extern "C" { rtn args; }
X
X
X
X
X
X
Xtypedef	short	boolean;
Xconst	true = 1;
Xconst	false = 0;
X
Xtypedef	unsigned	char	uchar;
X
Xtypedef	void		(*gen_fun)();
X
X
X
X# define	BLANK		' '
X# define	NL			'\n'
X# define	EOS			'\0'
X# define	HYPHEN		'-'
X# define	TAB			'\t'
X# define	STR_QUOTE	'"'
X# define	QUOTE		'\''
X# define	BQUOTE		'`'
X# define	SEMICOLON	';'
X# define	BACKSLASH	'\\'
X# define	PERIOD		'.'
X# define	COLON		':'
X# define	RPAREN		')'
X# define	LPAREN		'('
X# define	COMMA		','
X# define	QUESTION	'?'
X# define	BACKSPACE	'\b'
X# define	DEL			'\020'
X
X#ifndef	ALTGCC
X# define	NULL		0
X#endif
X# define    	NULL_STR    	""
X
X# define    	NEWLINE	    	"\n"
X
X# define	streq(str1, str2)		(strcmp ((str1), (str2)) == 0)
X
X# define  	copy_str(str)           strcpy (new char[2 + strlen((str))], (str))
X
X# ifdef		PRODUCTION
X# endif
X
X
X
X# endif
END_OF_common.h
if test 1067 -ne `wc -c <common.h`; then
    echo shar: \"common.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f test.C -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"test.C\"
else
echo shar: Extracting \"test.C\" \(129 characters\)
sed "s/^X//" >test.C <<'END_OF_test.C'
X//  -*- c++ -*-
X
X
X# include   "common.h"
X# include   <String.h>
X
X
Xmain (int argc, char* argv[])
X{
X    cout << "Hello world\n";
X}
END_OF_test.C
if test 129 -ne `wc -c <test.C`; then
    echo shar: \"test.C\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0

Newsgroups: gnu.g++.lib.bug