std::basic_streambuf<CharT,Traits>:: pbump
| 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 ) ; |
||
putポインタ
(
pptr()
) を
count
文字分再配置します。
count
は正または負の値を取ります。ポインタがput領域
[
pbase
(
)
,
epptr
(
)
)
の外側に移動するかどうかのチェックは行われません。
ポインタが進められ、その後 overflow() が呼び出されて出力領域が関連付けられた文字シーケンスにフラッシュされると、未定義値を持つ追加の count 文字が出力されるという効果が生じます。
目次 |
パラメータ
| count | - | 書き込みポインタに加算する数値 |
戻り値
(なし)
注記
この関数は int を受け取るため、 std:: numeric_limits < int > :: max ( ) 文字を超えるバッファを操作することはできません( LWG issue 255 )。
例
#include <fstream> #include <iostream> #include <string> struct showput_streambuf : std::filebuf { using std::filebuf::pbump; // 保護メンバを公開 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
関連項目
|
入力シーケンスの次のポインタを進める
(protected member function) |