setfill

To specify the characters to insert in unused spaces in the output.

smanip setfill(int c)

Remarks

Use the manipulator setfill() directly in the output to fill blank spaces with character c.

Returns a smanip type, which is an implementation defined type.

See Also

basic_ios::fill

Listing: Example of basic_ios::setfill() usage:
#include <iostream> 
#include <iomanip>

int main()
{
using namespace std;
   cout.width(8); 
   cout << setfill('*') << "Hi!" << "\n";
   char fill = cout.fill();
   cout << "The filler is a " << fill << endl;
   return 0;
}

Result:

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