fill

To insert characters into the stream's unused spaces.

  char_type fill() const
  char_type fill(char_type)

  
Remarks

Use fill(char_type) in output to fill blank spaces with a character. The function fill() is overloaded to return the current filler without altering it.

Returns the current character being used as a filler.

SeeAlso

manipulator setfill()

Listing: Example of fill() usage:
#include <iostream> 
int main()

{

using namespace std;

   char fill;

   cout.width(8); 

   cout.fill('*'); 

   fill = cout.fill();

   cout<< "Hi!" << "\n";

   cout << "The filler is a " << fill << endl;

   

   return 0;

}

Result:

  Hi!*****
  The filler is a *