Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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.

The current fill character.

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.

// 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;
}

Output

    a
xxxxa
x

Header: <ios>

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.