std::setfill
std::setfill (채움 문자 설정 조작자)
스트림의 채움 문자(fill character)를 c로 설정하는 조작자예요. iomanip 헤더에 있어요.
출처: cppreference
본문
<iomanip> 헤더에 정의돼 있어요.
template< class CharT >
/*unspecified*/ setfill( CharT c );
out << setfill(c) 표현식에서 스트림 out의 채움 문자를 c로 설정해요.
매개변수
c— 채움 문자의 새 값.
반환값
std::basic_ostream<CharT, Traits> 타입의 out에 대해 out << setfill(c)가 out 값과 f(out, c) 동작을 갖는 미지정 타입 객체. 여기서 f는 out.fill(c)를 호출하는 함수예요.
template<class CharT, class Traits>
void f(std::basic_ostream<CharT,Traits>& os, CharT c)
{
os.fill(c);
}
예제
#include <iostream>
#include <iomanip>
int main()
{
std::cout << std::setfill('*') << std::setw(5) << 42 << '\n'; // "***42"
}