다음을 통해 공유


basic_ios::copyfmt

Copies flags from one stream to another.

basic_ios<Elem, Traits>& copyfmt(
    const basic_ios<Elem, Traits>& _Right
);

매개 변수

  • _Right
    The stream whose flags you want to copy.

반환 값

The this object for the stream to which you are copying the flags.

설명

The member function reports the callback event erase_event. It then copies from _Right into *this the fill character, the tie pointer, and the formatting information. Before altering the exception mask, it reports the callback event copyfmt_event. If, after the copy is complete, state & exceptions is nonzero, the function effectively calls clear with the argument rdstate. It returns *this.

예제

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

int main( ) 
{
   using namespace std;
   ofstream x( "test.txt" );
   int i = 10;

   x << showpos;
   cout << i << endl;
   cout.copyfmt( x );
   cout << i << endl;
}

Output

10
+10

요구 사항

Header: <ios>

네임스페이스: std

참고 항목

참조

basic_ios 클래스

iostream 프로그래밍

iostreams 규칙