How do you get this stream restarted?
The istream set's, unset's and clear's
don't seem to do it.
Thanks,
Dick
This is system dependent and the poster didn't indicate the
system, but cin.clear() should work. I have tested the attached
program on a UNIX system with AT&T version's of iostreams.
Jerry Schwarz
----------------------------------
#include <iostream.h>
int main()
{
for(;;) {
if ( cin.eof() ) {
cout << "EOF" << endl;
cin.clear();
}
char c ;
if ( cin.get(c) ) cout.put(c) ;
}
}
Jerry--
Yes, that works okay in cfront and TC++.
In g++ where the problem first arose an additional
action is required:
cin.clear();
rewind ( _iob ); // Seems quite out of place, doesn't it?
// cfront also accepts but doesn't
// require this rewind.
Dick