ios::copyfmt |
public member functions |
ios& copyfmt ( const ios& rhs ); |
|
Copy formatting information
Copies the values of all the internal members of the object rhs (except the state flags and the stream buffer pointer) to the corresponding members of *this. This includes the format flags, the fill character, the tie pointer and all formatting information. Every external object pointed in rhs is copied to a newly constructed object for *this.
The exception mask is the last to be copied.
Before copying any parts of rhs, this member function triggers an erase_event event which invokes the registered callback functions, if any (see ios_base::register_callback).
Parameters
- rhs
- Object whose members are to be copied to *this
Return Value
The function returns
*this.
Example
// copying formatting information
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ofstream filestr;
filestr.open ("test.txt");
cout.fill ('*');
cout.width (10);
filestr.copyfmt (cout);
cout << 40;
filestr << 40;
return 0;
}
|
This example outputs a number formatted in the same way in both cout and filestr:
Basic template member declaration
(
basic_ios<charT,traits> )
basic_ios& copyfmt (const basic_ios& rhs );
|
See also
ios::tie | Get/set the tied stream (public member function) |
ios::fill | Get/set the fill character (public member function) |