Article View: comp.std.c++
Article #2851Re: streambuf derivation error or bug in istream::getline?
From: Bernd Eggink
Date: Mon, 04 Dec 1995 22:37
Date: Mon, 04 Dec 1995 22:37
37 lines
2032 bytes
2032 bytes
Christopher Barber (cbarber@bbn.com) wrote: > I have derived a new class from streambuf and overloaded most > of the virtual protected members (overflow, underflow, xsgetn, xsputn, etc) > but do not touch the stream pointer methods (setg, gbump, setp, etc) > and as far as I understand the standard I don't need to. > The problem is that the implementation of istream::getline which I am using > (in gnu libio - I don't know the version offhand) accesses the gbeg, gnext, > gend pointers directly and ends up in an infinite loop when these pointers > are null (which is their default value). > I think this is a bug in the istream::getline implementation, but given > the complexity of the iostream classes am willing to consider the > possiblity that I have just misunderstood the spec. Anyone, care to > comment? You MUST call setp() and segp() from within your functions overflow() and underflow() in order to set up the put/get area and reflect the fact that the put area is now empty and ready to be filled again, rsp. that the get area has been filled from the source and characters may now be extracted. Bernd -- +----------------------------------+ | Bernd Eggink | | Rechenzentrum Uni Hamburg | | admin@rzaix13.rrz.uni-hamburg.de | +----------------------------------+ --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<49um6d$dcd@rzsun02.rrz.uni-hamburg.de>Path:
arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!MattReferences:
<CBARBER.95Dec1093812@figaro.bbn.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt From: admin@rzaix13.uni-hamburg.de (Bernd Eggink) Newsgroups: comp.std.c++ Subject: Re: streambuf derivation error or bug in istream::getline? Date: 04 Dec 1995 22:37:11 GMT Organization: University of Hamburg -- Germany Approved: Matt@Austern Message-ID: <49um6d$dcd@rzsun02.rrz.uni-hamburg.de> References: <CBARBER.95Dec1093812@figaro.bbn.com> NNTP-Posting-Host: austern.hip.berkeley.edu