From owner-freebsd-hackers Tue Dec 17 19:08:51 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id TAA12291 for hackers-outgoing; Tue, 17 Dec 1996 19:08:51 -0800 (PST) Received: from po1.glue.umd.edu (root@po1.glue.umd.edu [129.2.128.44]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id TAA12277 for ; Tue, 17 Dec 1996 19:08:45 -0800 (PST) Received: from thurston.eng.umd.edu (thurston.eng.umd.edu [129.2.103.25]) by po1.glue.umd.edu (8.8.3/8.7.3) with ESMTP id WAA23465; Tue, 17 Dec 1996 22:08:37 -0500 (EST) Received: from localhost (chuckr@localhost) by thurston.eng.umd.edu (8.8.3/8.7.3) with SMTP id WAA21017; Tue, 17 Dec 1996 22:08:36 -0500 (EST) X-Authentication-Warning: thurston.eng.umd.edu: chuckr owned process doing -bs Date: Tue, 17 Dec 1996 22:08:36 -0500 (EST) From: Chuck Robey X-Sender: chuckr@thurston.eng.umd.edu To: Frank Nobis cc: hackers@freebsd.org Subject: Re: Weired c++ behaviour regarding iostreams In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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! ----------------------------+-----------------------------------------------