ios::fill
char fill ( ) const;
char fill ( char fillch );
ios
  cplusplus.com  

Get/set the fill character.
  The first syntax returns the fill character. The fill character is the character used by output insertion functions to fill spaces when padding results to the field width.
  The second syntax sets fillch as the new fill character and returns the previous fill character.

Parameters.

fillch
the new character to be used as fill character.

Return Value.
  The value of the fill character before the call.

Example.

// using fill character
#include <iostream>
using namespace std;

int main () {
  char prev;

  cout.width (10);
  cout << 40 << endl;

  prev = cout.fill ('x');
  cout.width (10);
  cout << 40 << endl;

  cout.fill(prev);

  return 0;
}
The output of this example could be:
        40
xxxxxxxx40

Basic template member declaration ( basic_ios<charT,traits> ):
typedef charT char_type;
char_type fill () const;
char_type fill ( char_type fillch );

See also.
  ios class


© The C++ Resources Network, 2001