共用方式為


ios_base::flags

Sets or returns the current flag settings.

fmtflags flags( ) const; 
fmtflags flags(
   fmtflags fmtfl
);

Parameters

  • fmtfl
    The new fmtflags setting.

Return Value

The previous or current fmtflags setting.

Remarks

See ios_base::fmtflags for a list of the flags.

The first member function returns the stored format flags. The second member function stores fmtfl in the format flags and returns its previous stored value.

Example

// ios_base_flags.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>

int main ( ) 
{
   using namespace std;
   cout << cout.flags( ) << endl;
   cout.flags( ios::dec | ios::boolalpha );
   cout << cout.flags( );
}
513
16896

Requirements

Header: <ios>

Namespace: std

See Also

Reference

ios_base Class

iostream Programming

iostreams Conventions