名前空間
変種

std::basic_ios<CharT,Traits>::fill

提供: cppreference.com
 
 
入出力ライブラリ
入出力マニピュレータ
Cスタイルの入出力
バッファ
(C++98で非推奨)
ストリーム
抽象
ファイル入出力
文字列入出力
配列入出力
(C++98で非推奨)
(C++98で非推奨)
(C++98で非推奨)
同期化出力
エラーカテゴリインタフェース
(C++11)
 
 
<tbody> </tbody>
CharT fill() const;
(1)
CharT fill( CharT ch );
(2)

指定されたフィールド幅に出力変換をパディングするために使用されるフィル文字を管理します。

1) 現在のフィル文字を返します。
2) フィル文字を ch に設定し、フィル文字の以前の値を返します。

引数

ch - フィル文字として使用する文字

戻り値

関数を呼ぶ前のフィル文字。

#include <iostream>
#include <iomanip>

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

関連項目

フィル文字を変更します
(関数テンプレート) [edit]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.