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.
http://www.cplusplus.com/ios_base::flags