Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::basic_...ambuf::pbump(3) C++ Standard Libarystd::basic_...ambuf::pbump(3)

NAME
       std::basic_streambuf::pbump - std::basic_streambuf::pbump

Synopsis
	  protected:
	  void pbump( int count	);

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

	  If the pointer is advanced and then overflow() 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 (LWG 255)

Example
       // Run this code

	#include <iostream>
	#include <string>
	#include <fstream>

	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';
	}

Output:
	The put	area contains: 1234
	after pbump(10), it contains 1234 is a test

See also
	  gbump	advances the next pointer in the input sequence
		(protected member function)

http://cppreference.com		  2022.07.31	 std::basic_...ambuf::pbump(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::basic_streambuf::pbump&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help