Share via


basic_ios::fill

Specifies or returns the character that will be used when the text is not as wide as the stream.

char_type fill( ) const; 
char_type fill( 
   char_type _Char 
);

Parameters

  • _Char
    The character you want as the fill character.

Return Value

The current fill character.

Remarks

The first member function returns the stored fill character. The second member function stores _Char in the fill character and returns its previous stored value.

Example

// basic_ios_fill.cpp
// compile with: /EHsc
#include <iostream>
#include <iomanip>

int main( ) 
{
   using namespace std;

   cout << setw( 5 ) << 'a' << endl;

   cout.fill( 'x' );
   cout << setw( 5 ) << 'a' << endl;

   cout << cout.fill( ) << endl;
}

a xxxxa x

Requirements

Header: <ios>

Namespace: std

See Also

Reference

basic_ios Class

iostream Programming

iostreams Conventions

Other Resources

basic_ios Members