ios::copyfmt
ios& copyfmt ( const ios& rhs );
ios
  cplusplus.com  

Copy formatting information.
  Copies the values of all the internal members of 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.

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 bot cout and filestr:
********40

Basic template member declaration ( basic_ios<charT,traits> ):
basic_ios& copyfmt (const basic_ios& rhs );

See also.
  tie, fill, width, fmtflags, iostate, locale
  ios class


© The C++ Resources Network, 2001