Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!ukc!kl-cs!nott-cs!ucl-cs!T.Day From: T.Day@ucl-cs.UUCP Newsgroups: gnu.g++.lib.bug Subject: Reading last thing from an istream Message-ID: <473@ucl-cs.UUCP> Date: 26 Nov 89 20:04:45 GMT Sender: T.Day@ucl-cs.UUCP Lines: 28 From: Tim Day // Bug or feature ? In libg++ 1.36 using g++ 1.36.1 // I'm think this behaved differently with libg++ 1.35. A 2.0ism ? // The problem is that if the last integer is not followed by whitespace // the istream will go bad... I'd expect this to happen only on a subsequent // attempt to read #include main() { unlink("foo"); {ostream foo("foo",io_writeonly,a_create); foo << 1 << " " << 2 << " " << 3;// No trailing whitespace after 3 } {istream foo("foo",io_readonly,a_useonly); int count=0,n; while (foo >> n) {cerr << n << " ";count++;} cerr << " : " << count << " integers read\n"; } exit(0); } // Outputs : // 1 2 : 2 integers read