共用方式為


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 the manipulators section for ios 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

Concepts

ios_base Class

ios_base Members

iostream Programming

iostreams Conventions