Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>ios::width</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ios::width

Usage

   #include <iostream.hpp>
   int width(int next_field_width);
   int width() const;

Description

   Sets or reads the field width that will be used for the next I/O
   operation. Formatted output operations will have their length padded out
   to this specified field width according to the setting of the
   left/right/internal format flags. Default padding is such as to give
   right justification. The width setting normally affects only a single
   output operation, the output operation setting the width back to zero,
   which is the default condition, and means no padding. If the
   ios::stickywidth format flag is set, the field width value persists until
   it is set to some other value by a call to width.

Example 

   cout.width(6);

   cout << '!' << 333 << 999;      // output is    !   333999
   cout.width(6);
   cout.setf(ios::stickywidth);
   cout << '!' << 333 << 999;      // output is    !   333   999
   cout.width(6);
   cout << '!' << 333 << 999;      // output is    !   333999

Return Value

   The const version returns the currently set width, the other returns the
   width before modification.





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson