function
<iomanip>

std::setiosflags

/*unspecified*/ setiosflags (ios_base::fmtflags mask);
Set format flags
Sets the format flags specified by parameter mask.

Behaves as if member setf were called with mask as argument on the stream on which it is inserted/extracted as a manipulator (it can be inserted/extracted on input streams or output streams).

See ios_base::fmtflags for more information on the particular flags that can be modified with this manipulator function.

This manipulator is declared in header <iomanip>.

Parameters

mask
Mask representing the flags to be set.
fmtflags is a bitmask type.

Return Value

Unspecified. This function should only be used as a stream manipulator (see example).

Example

1
2
3
4
5
6
7
8
9
10
// setiosflags example
#include <iostream>     // std::cout, std::hex, std::endl
#include <iomanip>      // std::setiosflags

int main () {
  std::cout << std::hex;
  std::cout << std::setiosflags (std::ios::showbase | std::ios::uppercase);
  std::cout << 100 << std::endl;
  return 0;
}

This code uses setiosflags to activate both the showbase and uppercase flags, with the same effect as if inserting the manipulators showbase and uppercase.

Output:

0X64


Data races

The stream object on which it is inserted/extracted is modified.
Concurrent access to the same stream object may introduce data races.

Exception safety

Basic guarantee: if an exception is thrown, the stream is in a valid state.

See also