basic_ios::copyfmt
Copies flags from one stream to another.
basic_ios<Elem, Traits>& copyfmt(
const basic_ios<Elem, Traits>& _Right
);
Parameters
- _Right
The stream whose flags you want to copy.
Return Value
The this object for the stream to which you are copying the flags.
Remarks
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.
Example
// 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
Requirements
Header: <ios>
Namespace: std