Share via


ios::flags

long flags( long lFlags );

long flags() const;

Return Value

The first overloaded flags function sets the stream’s internal flags variable to lFlags and returns the previous value.

The second function returns the stream’s current flags.

Parameter

lFlags

The new format flag values for the stream. The values are specified by the following bit masks (ios enumerators) that can be combined using the bitwise OR ( | ) operator. The lFlags parameter must have one of the following values:

  • ios::skipws   Skip white space on input.

  • ios::left   Left-align values; pad on the right with the fill character.

  • ios::right   Right-align values; pad on the left with the fill character (default alignment).

  • ios::internal   Add fill characters after any leading sign or base indication, but before the value.

  • ios::dec   Format numeric values as base 10 (decimal) (default radix).

  • ios::oct   Format numeric values as base 8 (octal).

  • ios::hex   Format numeric values as base 16 (hexadecimal).

  • ios::showbase   Display numeric constants in a format that can be read by the C++ compiler.

  • ios::showpoint   Show decimal point and trailing zeros for floating-point values.

  • ios::uppercase   Display uppercase A through F for hexadecimal values and E for scientific values.

  • ios::showpos   Show plus signs (+) for positive values.

  • ios::scientific   Display floating-point numbers in scientific format.

  • ios::fixed   Display floating-point numbers in fixed format.

  • ios::unitbuf   Cause ostream::osfx to flush the stream after each insertion. By default, cerr is unit buffered.

  • ios::stdio   Cause ostream::osfx to flush stdout and stderr after each insertion.

ios OverviewAbstract Stream Base Class

See Also   ios::setf, ios::unsetf, ios setiosflags manipulator, ios resetiosflags manipulator, ios::adjustfield, ios::basefield, ios::floatfield