| I/O manipulators | ||||
| Print functions(C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++20) | ||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
| Synchronized Output | ||||
(C++20) | ||||
| Types | ||||
| Error category interface | ||||
(C++11) | ||||
(C++11) |
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
protected: void pbump(int count); | ||
Repositions theput pointer (pptr()) bycount characters, wherecount 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 thenoverflow() is called to flush the put area to the associated character sequence, the effect is that extracount characters with undefined values are output.
Contents |
| count | - | number to add to the put pointer |
(none)
Because this function takes anint, it cannot manipulate buffers larger thanstd::numeric_limits<int>::max() characters (LWG issue 255).
#include <fstream>#include <iostream>#include <string> struct showput_streambuf:std::filebuf{using std::filebuf::pbump;// expose protectedstd::string showput()const{returnstd::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: 1234after pbump(10), it contains 1234 is a test
| advances the next pointer in the input sequence (protected member function)[edit] |