std::basic_streambuf::pbump
来自cppreference.com
< cpp | io | basic streambuf
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
void pbump( int count ); |
||
重新定位的“指针”(
pptr()
)count
字符,其中count
可能是正的或负的。任何检查都做了为移动指针外的认沽区[pbase(), epptr())
.原文:
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())
.如果指针是先进的,然后
overflow()
被称为刷新认沽区域相关的字符序列,其效果是额外的count
未定义的值是字符输出.原文:
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.目录 |
[编辑] 参数
count | - | 数添加到把指针
|
[编辑] 返回值
(无)
[编辑] 示例
#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
[编辑] 另请参阅
在输入序列中的下一个指针前进 原文: advances the next pointer in the input sequence (受保护的成员函数) |