Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 1996 22:08:36 -0500 (EST)
From:      Chuck Robey <chuckr@glue.umd.edu>
To:        Frank Nobis <fn@radio-do.de>
Cc:        hackers@freebsd.org
Subject:   Re: Weired c++ behaviour regarding iostreams
Message-ID:  <Pine.OSF.3.95.961217220440.21136A-100000@thurston.eng.umd.edu>
In-Reply-To: <ygerakog401.fsf@trinity.radio-do.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 18 Dec 1996, Frank Nobis wrote:

> 
> Hi there,
> 
> I have a weired problem using the iostream lib.
> 
> I have a small program wich opens a file and print out the context.
> 
> On my 2.2-961014-SNAP with g++ 2.7.2.1 and on a Sun runnning Solaris
> 5.5 same gcc version, EOF is not recognized and the program hangs
> until ^C is pressed. 
> 
> I have checked against a fresh installed 2.1.5-RELEASE with gcc
> version 2.6.3. Everything is running as expected.
> 
> Here is my small test program.

Trouble is, you try to use both stdio.h (which is C's i/o functions) and
iostream.h (which is C++'s i/o functions).  Since they both try to do
buffering of their own, outside of the operating system buffering, this is
a big no-no.  Choose your poison, either stdio.h (which works fine with
C++) or iostreams, but not both.  I like stdio.h myself, because I think
it's better documented, but I think most C++ coders like iostreams.

When I see man pages on the C++ iostreams functions appear, I'll probably
consider going over, but not until then.

----------------------------+-----------------------------------------------
Chuck Robey                 | Interests include any kind of voice or data 
chuckr@eng.umd.edu          | communications topic, C programming, and Unix.
9120 Edmonston Ct #302      |
Greenbelt, MD 20770         | I run Journey2 and picnic, both FreeBSD
(301) 220-2114              | version 3.0 current -- and great FUN!
----------------------------+-----------------------------------------------




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.3.95.961217220440.21136A-100000>