Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
IOstream Library
manipulators
classes:
filebuf
fstream
ifstream
ios
iostream
ios_base
istream
istringstream
ofstream
ostream
ostringstream
streambuf
stringbuf
stringstream
objects:
cerr
cin
clog
cout
types:
fpos
streamoff
streampos
streamsize
manipulators
boolalpha
dec
endl
ends
fixed
flush
hex
internal
left
noboolalpha
noshowbase
noshowpoint
noshowpos
noskipws
nounitbuf
nouppercase
oct
resetiosflags
right
scientific
setbase
setfill
setiosflags
setprecision
setw
showbase
showpoint
showpos
skipws
unitbuf
uppercase
ws


setiosflags

manipulator function
<iomanip>
smanip setiosflags ( ios_base::fmtflags mask );

Set format flags

Sets the format flags specified by parameter mask.

Behaves as if a call to the stream's member ios_base::setf with mask as argument was made.

This manipulator is declared in header <iomanip>, along with the other parameterized manipulators: resetiosflags, setbase, setfill, setprecision and setw. This header file declares the implementation-specific smanip type, plus any additional operator overload function needed to allow these manipulators to be inserted and extracted to/from streams with their parameters.

Parameters

mask
Mask representing the flags to be set.
This is an object of type ios_base::fmtflags which can take any combination of its possible values (see ios_base::fmtflags).

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>
#include <iomanip>
using namespace std;
int main () {
  cout << hex << setiosflags (ios_base::showbase | ios_base::uppercase);
  cout << 100 << endl;
  return 0;
}


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

See also