From owner-freebsd-hackers Tue Dec 17 15:17:44 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id PAA27111 for hackers-outgoing; Tue, 17 Dec 1996 15:17:44 -0800 (PST) Received: from trinity.radio-do.de (fn@trinity.Radio-do.de [193.101.164.3]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id PAA26730 for ; Tue, 17 Dec 1996 15:12:56 -0800 (PST) Received: by trinity.radio-do.de (8.7.6/CLIENT-1.2.7-h) via EUnet id AAA01499; Wed, 18 Dec 1996 00:11:58 +0100 (MET) To: hackers@freebsd.org Subject: Weired c++ behaviour regarding iostreams From: Frank Nobis Date: 18 Dec 1996 00:11:58 +0100 Message-ID: Lines: 61 X-Mailer: Red Gnus v0.74/XEmacs 19.14 Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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. ------------------------------------------------------------------------------ // stream1.cc #include #include #include #include int main(int argc, char **argv) { char c; int fd; ifstream file; // fd = open("/etc/motd", 0444, O_RDONLY); // cout << "File descriptor is: " << fd << "\n"; file.ifstream("stream1.cc"); // file.sync_with_stdio(); while (file.get(c)) { if (file.eof()) break; // cout.put(c); cout << c; } exit (0); } ------------------------------------------------------------------------------ Has someone an idea what is going wrong? Regards Frank -- Frank Nobis Email: fn@Radio-do.de PGP AVAILABLE Landgrafenstr. 130 dg3dcn http://www.radio-do.de/~fn/ 44139 Dortmund Powered by FreeBSD Fax: +49 231 7213816