From cppreference.com
protected:voidpbump(intcount);Repositions the put pointer (
) by count characters, where count may be positive or negative. No checks are done for moving the pointer outside the put area [pbase(), epptr()).
If the pointer is advanced and then
is called to flush the put area to the associated character sequence, the effect is that extra count characters with undefined values are output.
Parameters
count - number to add to the put pointer Return value
(none)
Notes
Because this function takes an int, it cannot manipulate buffers larger than std::numeric_limits<int>::max() characters (
).
Example
Run this code
#include<fstream>#include<iostream>#include<string>structshowput_streambuf:std::filebuf{usingstd::filebuf::pbump;// expose protectedstd::stringshowput()const{returnstd::string(pbase(),pptr());}};intmain(){showput_streambufmybuf;mybuf.open("test.txt",std::ios_base::out);std::ostreamstr(&mybuf);str<<"This is a test"<<std::flush<<"1234";std::cout<<"The put area contains: "<<mybuf.showput()<<'\n';mybuf.pbump(10);std::cout<<"after pbump(10), it contains "<<mybuf.showput()<<'\n';}Output:
The put area contains: 1234 after pbump(10), it contains 1234 is a test See also
advances the next pointer in the input sequence
(protected member function)