次の方法で共有


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

Concepts

basic_ios Class

basic_ios Members

iostream Programming

iostreams Conventions