CharT fill() const; |
(1) |
|
CharT fill( CharT ch ); |
(2) |
|
| | |
管理用於填充輸出轉換到指定欄位寬度的填充字元。
1) 返回當前的填充字元。
2) 將填充字元設定為 ch,返回填充字元的先前值。
[編輯] 引數
[編輯] 返回值
呼叫函式之前的填充字元。
[編輯] 示例
#include <iomanip>
#include <iostream>
int main ()
{
std::cout << "With default setting : [" << std::setw(10) << 40 << "]\n";
char prev = std::cout.fill('x');
std::cout << "Replaced '" << prev << "' with '"
<< std::cout.fill() << "': [" << std::setw(10) << 40 << "]\n";
}
輸出
With default setting : [ 40]
Replaced ' ' with 'x': [xxxxxxxx40]
[編輯] 參閱