On Dec 12, 9:12 am, "Christopher Pisz" <some...@somewhere.net> wrote:
> I am trying to empty and reset my internal buffer in my
> derived sync method.
> Am I correct in assuming I can call setp( std::streambuf:
base(),
> std::streambuf:
base()); to reset the internal buffer?
It depends on what you want to do. If you simply want to clear
the buffer, making sure that the next attempt to write will end
up calling overflow() (where presumably, you'll reinitialize
it), then setting both pointers to NULL is the simplest
solution. If you want to initialize a new (empty) buffer, the
first pointer should be the address of the buffer, and the
second the address one past the end of the buffer.
> Also, I am unsure whether the pointer returned by epptr() is
> supposed to point just beyond the end of the sequence or at
> the last element of the sequence?
One past the end. epptr() - pbase() is the length of the
buffer.
> As such, should the second argument to my setp call be
> std::streambuf:
base() + 1?
That would provide a buffer of size 1.
--
James Kanze (GABI Software) email:
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34