std::ios_base::width

std::ios_base::width

streamsize width() const;
(1)
streamsize width( streamsize new_width );
(2)

Manages the minimum number of characters to generate on certain output operations and the maximum number of characters to generate on certain output operations.

1) Returns the current field width.
2) Sets the field width to the given one.

Parameters

new_width - new field width setting

Return value

The field width before the call to the function.

Notes

Some I/O functions call width(0) before returning, see std::setw (this results in this field having effect on the next I/O function only, and not on any subsequent I/O).

The exact effects this modifier has on the input and output vary between the individual I/O functions and are described at each operator<< and operator>> overload page individually.

Example

See also

manages decimal precision of floating point operations
(public member function)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/io/ios_base/width

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部