Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::setfill

 

std::setfill is an STL std::iostream manipulator to determine the filling/padding character used by std::setw.

 

#include <iomanip>
#include <iostream>

int main()
{
  const int value = 123;
  std::cout
    << "12345678\n"
    << std::setw(8) << value << '\n'
    << std::setfill('x') << std::setw(8) << value << '\n';
}

 

Screen output:

 

12345678
     123
xxxxx123

 

 

 

 

 

External links

 

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict