Date: 18 Dec 1996 00:11:58 +0100 From: Frank Nobis <fn@radio-do.de> To: hackers@freebsd.org Subject: Weired c++ behaviour regarding iostreams Message-ID: <ygerakog401.fsf@trinity.radio-do.de>
next in thread | raw e-mail | index | archive | help
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 <iostream.h> #include <fstream.h> #include <stdio.h> #include <fcntl.h> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ygerakog401.fsf>