When used in an expression out << setfill(c)
sets the fill character of the stream out to c
.
Note: The current fill character may be obtained with std::ostream::fill
.
Example:
#include <iostream>
#include <iomanip>
int main()
{
std::cout << "default fill: " << std::setw(10) << 42 << '\n'
<< "setfill('*'): " << std::setfill('*')
<< std::setw(10) << 42 << '\n';
}
//output::
//default fill: 42
//setfill('*'): ********42