|
ios_base::setfpublic member function
fmtflags setf ( fmtflags fmtfl ); fmtflags setf ( fmtflags fmtfl, fmtflags mask ); Set specific format flags The first syntax sets the stream's format flags whose bits are set in fmtfl leaving unchanged the rest, as if a call to flags (fmtfl | flags())The second syntax sets the stream's format flags whose bits are set in both fmtfl and mask, and clears the format flags whose bits are set in mask but not in fmtfl, as if a call to flags ( (fmtfl & mask) | (flags() & ~mask) ) Both member functions return the value of the stream's format flags existing before the call. 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 arguments. The first syntax of setf is generally used to set unary format flags: boolalpha, showbase, showpoint, showpos, skipws, unitbuf and uppercase, which can also be unset directly with unsetf. On the other hand, the second syntax is generally used to set a value for one of the selective flags, using one of the field bitmasks as the mask argument:
The parameterized manipulator setiosflags behaves in a similar manner as the single-parameter version of this member function. Parameters
Return ValueThe format flags set in the stream before the call.Example
The execution of this example displays something similar to:
See also
|