setf

Set the stream format flags.

  fmtflags setf(fmtflags)
  fmtflags setf(fmtflags, fmtflags)
  
Remarks

You should use the function setf() to set the formatting flags for input/output. It is overloaded. The single argument form of setf() sets the flags in the mask. The two argument form of setf() clears the flags in the first argument before setting the flags with the second argument.

type basic_ios::fmtflags is returned.

Listing: Example of setf() usage:
#include <iostream>
int main()

{

using namespace std;

   double d = 10.01;

   cout.setf(ios::showpos | ios::showpoint);

   cout << d << endl;                                  

   cout.setf(ios::showpoint, ios::showpos | ios::showpoint);

   cout << d << endl;      

   return 0;

}

Result:

  +10.01
  10.01