resetiosflags

To unset previously set formatting flags.

Prototypes

smanip resetiosflags(ios_base::fmtflags mask)

Remarks

Use the manipulator resetiosflags directly in a stream to reset any format flags to a previous condition. You would normally store the return value of setf() in order to achieve this task.

A smanip type is returned, which is an implementation defined type.

See Also

ios_base::setf(), ios_base::unsetf()

Listing: Example of resetiosflags() usage:
#include <iostream>
#include <iomanip>

int main()
{
using namespace std;
   double d = 2933.51;
   long flags;
   flags = ios::scientific | ios::showpos | ios::showpoint;
 
   cout << "Original: " << d << endl;
   cout << "Flags set: " << setiosflags(flags) 
      << d << endl;
   cout << "Flags reset to original: "
      << resetiosflags(flags) << d << endl;
   return 0;
}

Result:

  Original:   2933.51

  Flags set:   +2.933510e+03

  Flags reset to original:   2933.51