std::basic_streambuf<CharT,Traits>::pbump

Repositions the put pointer (pptr()) by count characters, where count may be positive or negative. No checks are done for moving the pointer outside the put area [pbase(),epptr()).

# Declarations

protected:
void pbump( int count );

# Parameters

# Return value

(none)

# Notes

Because this function takes an int, it cannot manipulate buffers larger than std::numeric_limits::max() characters (LWG issue 255).

# Example

#include <fstream>
#include <iostream>
#include <string>
 
struct showput_streambuf : std::filebuf
{
    using std::filebuf::pbump; // expose protected
    std::string showput() const
    {
        return std::string(pbase(), pptr());
    }
};
 
int main()
{
    showput_streambuf mybuf;
    mybuf.open("test.txt", std::ios_base::out);
    std::ostream str(&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';
}

# See also