Behaves as if a call to the stream's member ios_base::width with n as its argument was made.
The field width determines the minimum number of characters to be written in some output representations. If the standard width of the representation is shorter than the field width, the representation is padded with fill characters (see setfill) at a point determined by the format flag adjustfield (left, right or internal).
This manipulator is declared in header <iomanip>, along with the other parameterized manipulators: resetiosflags, setiosflags, setbase, setfill and setprecision. This header file declares the implementation-specific smanip type, plus any additional operator overload function needed to allow these manipulators to be inserted and extracted to/from streams with their parameters.
- Number of characters to be used as field width.
Return ValueUnspecified. This function should only be used as a stream manipulator.
This code uses setw to set the field width to 10 characters.
|setfill||Set fill character (manipulator function)|
|ios_base::width||Get/set field width (public member function)|