The first form (1) returns the format flags currently selected in the stream.
The second form (2) sets new 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 these are written by certain output functions. See ios_base::fmtflags for the possible values of this function's argument and the interpretation of its return value.
The second form of this function sets the value for all the format flags of the stream, overwriting the existing values and clearing any flag not explicitly set in the argument. To access individual flags, see members setf and unsetf.