Namespaces
Variants

std::basic_streambuf<CharT,Traits>:: pbump

From cppreference.net
protected :
void pbump ( int count ) ;

put pointer ( pptr() )를 count 문자만큼 재위치시킵니다. 여기서 count 는 양수나 음수일 수 있습니다. 포인터를 put area [ pbase ( ) , epptr ( ) ) 바깥으로 이동시키는 것에 대한 검사는 수행되지 않습니다.

포인터가 진행된 후 overflow() 가 호출되어 put 영역을 연관된 문자 시퀀스로 플러시하는 경우, 그 효과는 정의되지 않은 값을 가진 추가 count 개의 문자가 출력되는 것입니다.

목차

매개변수

count - put 포인터에 추가할 숫자

반환값

(없음)

참고 사항

이 함수가 int 를 취하기 때문에, std:: numeric_limits < int > :: max ( ) 문자보다 큰 버퍼를 조작할 수 없습니다 ( LWG issue 255 ).

예제

#include <fstream>
#include <iostream>
#include <string>
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

참고 항목

입력 시퀀스의 다음 포인터를 전진시킴
(protected member function)