std::setfill

Header: <iomanip>

When used in an expression out « setfill(c) sets the fill character of the stream out to c.

# Declarations

template< class CharT >
/*unspecified*/ setfill( CharT c );

# Parameters

# Return value

An object of unspecified type such that

# Notes

The current fill character may be obtained with std::ostream::fill.

# Example

#include <iomanip>
#include <iostream>
 
int main()
{
    std::cout << "default fill: [" << std::setw(10) << 42 << "]\n"
              << "setfill('*'): [" << std::setfill('*')
                                   << std::setw(10) << 42 << "]\n";
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 183C++98setbase could only be used withstreams of type std::ostreamusable with any outputcharacter stream

# See also