다음을 통해 공유


basic_ios::rdbuf

버퍼를 지정 된 스트림에 경로.

basic_streambuf<Elem, Traits> *rdbuf( ) const;
basic_streambuf<Elem, Traits> *rdbuf( 
    basic_streambuf<Elem, Traits> *_Sb
);

매개 변수

  • _Sb
    스트림입니다.

설명

첫 번째 멤버 함수가 저장 된 스트림 버퍼 포인터를 반환합니다.

두 번째 멤버 함수 저장소 _Sb 저장된 스트림 버퍼 포인터에서 이전에 저장 된 값을 반환 합니다.

예제

// basic_ios_rdbuf.cpp
// compile with: /EHsc
#include <ios>
#include <iostream>
#include <fstream>

int main( ) 
{
   using namespace std;
   ofstream file( "rdbuf.txt" );
   streambuf *x = cout.rdbuf( file.rdbuf( ) );
   cout << "test" << endl;   // Goes to file
   cout.rdbuf(x);
   cout << "test2" << endl;
}
  

요구 사항

헤더: <ios>

네임 스페이스: std

참고 항목

참조

basic_ios Class

iostream 프로그래밍

iostreams 규칙