The second syntax sets a new set of format flags for the stream, returning its former value.
The format flags of a stream affect the way data is interpreted in certain input functions and how it is written by certain output functions. See ios_base::fmtflags for the possible values of this function's argument.
The second syntax of this function sets the value for all the format flags of the stream, overwritting the existing values and clearing any flag not explicitly set in the argument. To modify just a single format flag, the member functions setf and unsetf are generally preferred.
- Format flags to be used by the stream. It is a value of type ios_base::fmtflags.
Return ValueThe format flags of the stream before the call.
This simple example sets some format flags for cout that affect the latter insertion operation by printing the value in hexadecimal base format (0x64) padded right as in a field ten spaces long:
|ios_base::setf||Set specific format flags (public member function)|
|ios_base::unsetf||Clear specific format flags (public member function)|
|ios_base::fmtflags||Type for stream format flags (public member type)|
|setiosflags||Set format flags (manipulator function)|