To specify the characters to insert in unused spaces in the output.
smanip setfill(int c)
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.
basic_ios::fill
#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 *