std::basic_streambuf::pbump
void pbump( int count ); | | |
|---|
重新定位放置指针%28pptr()29%count人物,在哪里count可能是积极的,也可能是消极的。不检查指针是否移出PUT区域。[pbase(), epptr())...
如果指针是高级的,则overflow()调用,将PUT区域刷新为关联的字符序列,其效果是额外的count输出未定义值的字符。
参数
count | - | number to add to the put pointer |
|---|
返回值
%280%29
例
二次
#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';
}二次
产出:
二次
The put area contains: 1234
after pbump(10), it contains 1234 is a test二次
另见
gbump | advances the next pointer in the input sequence (protected member function) |
|---|
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

