Compartir a través de


ios_base::width

Sets the length of the output stream.

streamsize width( ) const; 
streamsize width(
   streamsize _Wide
);

Parameters

  • _Wide
    The desired size of the output stream.

Return Value

The current width setting.

Remarks

The first member function returns the stored field width. The second member function stores _Wide in the field width and returns its previous stored value.

Example

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

int main( ) {
   using namespace std;
   
   cout.width( 20 );
   cout << cout.width( ) << endl;
   cout << cout.width( ) << endl;
}
                  20
0

Requirements

Header: <ios>

Namespace: std

See Also

Reference

ios_base Class

iostream Programming

iostreams Conventions

Other Resources

ios_base Members