stephen@comp.lancs.ac.uk (Stephen J. Muir) (08/18/86)
I wanted to write a routine which would read one file and write another, a line at a time. I was rather annoyed to find that the "get" routine for "istream"s left the '\n' in the stream instead of skipping past it. Surely, if I want to read a line at a time, I'm not interested in the line terminator (which I *know* the value of because I have, implicitly or otherwise, specified it). Anyway, I wrote a quick test program and found, to my annoyance, that each output line appears the line after I expected it to. Here is what I wrote: # include <stream.h> char buf [82]; main () { while (cin.get (buf, 80)) { char c; cin.get (c); cout << buf << "\n"; } } In desperation, I put a "cout.flush();" after line 9, which didn't help. C++ Version 1.1, BSD 4.2, VAX-11/750. -- EMAIL: stephen@comp.lancs.ac.uk | Post: University of Lancaster, UUCP: ...!mcvax!ukc!dcl-cs!stephen | Department of Computing, Phone: +44 524 65201 Ext. 4120 | Bailrigg, Lancaster, UK. Project:Alvey ECLIPSE Distribution | LA1 4YR