cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : IOstream Library : manipulators : setiosflags
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
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
smanip setiosflags ( ios_base::fmtflags mask );
<iomanip>

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

// 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

resetiosflags Reset format flags (manipulator function)
ios_base::setf Set specific format flags (public member function)
ios_base::flags Get/set format flags (public member function)

Home page | Privacy policy
© cplusplus.com, 2000-2008 - All rights reserved - v2.2
Spotted an error? contact us