Path: utzoo!yunexus!ists!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!TOUTLE.CS.WASHINGTON.EDU!wayne From: wayne@TOUTLE.CS.WASHINGTON.EDU (Wayne Winder) Newsgroups: gnu.g++.bug Subject: problem with cin return Message-ID: <8911171858.AA23884@toutle.cs.washington.edu> Date: 17 Nov 89 18:58:28 GMT Article-I.D.: toutle.8911171858.AA23884 Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 35 Running g++ (1.35.0) on a sun 3, OS3.5 I report this since I'm sure this used to work, but doesn't with this version. The following program gets into an infinite loop when the standard input is redirected from a file which does not terminate with a . ----------------- #include main() { char buf[100]; int i = 0; while (cin >> buf) i++; cout << "i: " << i << "\n"; } ----------------- It also does not behave as expected when the standard input is pushed in via . The return from "cin >> buf" appears to be the cin reference, which correctly shows eof to be true when the (redirected) input file does not end with . This correctly returns a when the input file has a terminating . Wayne E. Winder Northwest Lab for Integrated Systems University of Washington