std::setfill
来自cppreference.com
| 定义于头文件 <iomanip>
|
||
| template< class CharT > /*unspecified*/ setfill( CharT c ); |
||
用于表达式 out << setfill(c) 时,它设置流 out 的填充字符为 c 。
参数
| c | - | 填充字符的新值 |
返回值
返回未指定类型对象,使得若 out 为 std::basic_ostream<CharT, Traits> 类型输出流的名称,则表达式 out << setfill(n) 表现如同执行下列代码:
out.fill(n);
注意
可用 std::ostream::fill 获得当前填充字符。
示例
运行此代码
输出:
default fill: 42
setfill('*'): ********42参阅
| 管理填充字符 ( std::basic_ios<CharT,Traits> 的公开成员函数) | |
| 设置填充字符的布置 (函数) | |
| 更改下个输入/输出域的宽度 (函数) |