|
setwmanipulator function
<iomanip> smanip setw ( int n ); Set field width Sets the number of characters to be used as the field width for the next insertion operation.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. Parameters
Return ValueUnspecified. This function should only be used as a stream manipulator.Example
This code uses setw to set the field width to 10 characters. See also
|