Namespaces
Variants

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

From cppreference.net
CharT fill ( ) const ;
(1)
CharT fill ( CharT ch ) ;
(2)

지정된 필드 너비로 출력 변환을 채우는 데 사용되는 채움 문자를 관리합니다.

1) 현재 채움 문자를 반환합니다.
2) 채우기 문자를 ch 로 설정하고, 이전 채우기 문자 값을 반환합니다.

목차

매개변수

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]

참고 항목

채움 문자를 변경합니다
(function template)