Article View: gnu.g++.lib.bug
Article #66Re: iostream missing operator>>(istream&,streambuf*)
From: bothner
Date: Mon, 13 Apr 1992 05:12
Date: Mon, 13 Apr 1992 05:12
24 lines
912 bytes
912 bytes
Try the following:
istream& operator>>(istream& is, register streambuf* sbuf)
{
if (is.ipfx0()) {
register streambuf* inbuf = is.rdbuf();
// FIXME: Should optimize!
for (;;) {
register int ch = inbuf->sbumpc();
if (ch == EOF) {
is.set(ios::eofbit);
break;
}
if (sbuf->sputc(ch) == EOF) {
is.set(ios::failbit);
break;
}
}
}
return is;
}
--Per Bothner
Cygnus Support bothner@cygnus.com
Technical Details
Message-ID:
<9204131912.AA24886@cygnus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!bothnerReferences:
<1992Apr12.072620.17545@muddcs.claremont.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!bothner From: bothner@cygnus.com Subject: Re: iostream missing operator>>(istream&,streambuf*) Message-ID: <9204131912.AA24886@cygnus.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet References: <1992Apr12.072620.17545@muddcs.claremont.edu> Distribution: gnu Date: Mon, 13 Apr 1992 05:12:30 GMT Approved: bug-lib-g++@prep.ai.mit.edu Lines: 25