basic_ios::fill

指定或返回要使用字符,在文本未的宽度相同的时。流。

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

参数

  • _Char
    要作为填充字符的字符。

返回值

当前填充字符。

备注

第一个成员函数返回存储的填充字符。 第二个成员函数存储在填充字符的 _Char 并返回其以前存储的值。

示例

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

要求

页眉: <ios>

命名空间: std

请参见

参考

basic_ios 类

iostream 编程

iostreams 约定