##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::ios_base::width

From cppreference.com
< cpp‎ | io‎ | ios base

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 character to generate on certain input operations.

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

### [edit] Parameters

new_width | - | new field width setting

### [edit] Return value

The field width before the call to the function

### [edit] 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)

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

precision | manages decimal precision of floating point operations (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/io/ios_base/width&oldid=64712"
Category:

- Todo no example