GNU Info

Info Node: (iostream-295.info)Format Control

(iostream-295.info)Format Control


Next: Manipulators Prev: States Up: Ios
Enter node , (file) or (file)node

Choices in formatting
---------------------

   These methods control (or report on) settings for some details of
controlling streams, primarily to do with formatting output:

 - Method: char ios::fill () const
     Report on the padding character in use.

 - Method: char ios::fill (char PADDING)
     Set the padding character.  You can also use the manipulator
     `setfill'.  *Note Changing stream properties in expressions:
     Manipulators.

     Default: blank.

 - Method: int ios::precision () const
     Report the number of significant digits currently in use for
     output of floating point numbers.

     Default: `6'.

 - Method: int ios::precision (int SIGNIF)
     Set the number of significant digits (for input and output numeric
     conversions) to SIGNIF.

     You can also use the manipulator `setprecision' for this purpose.
     Note: Changing stream properties using manipulators.

 - Method: int ios::width () const
     Report the current output field width setting (the number of
     characters to write on the next `<<' output operation).

     Default: `0', which means to use as many characters as necessary.

 - Method: int ios::width (int NUM)
     Set the input field width setting to NUM.  Return the _previous_
     value for this stream.

     This value resets to zero (the default) every time you use `<<';
     it is essentially an additional implicit argument to that
     operator.  You can also use the manipulator `setw' for this
     purpose.  *Note Changing stream properties using manipulators:
     Manipulators.

 - Method: fmtflags ios::flags () const
     Return the current value of the complete collection of flags
     controlling the format state.  These are the flags and their
     meanings when set:

    `ios::dec'
    `ios::oct'
    `ios::hex'
          What numeric base to use in converting integers from internal
          to display representation, or vice versa: decimal, octal, or
          hexadecimal, respectively.  (You can change the base using
          the manipulator `setbase', or any of the manipulators `dec',
          `oct', or `hex'; Note: Changing stream properties in
          expressions..)

          On input, if none of these flags is set, read numeric
          constants according to the prefix: decimal if no prefix (or a
          `.' suffix), octal if a `0' prefix is present, hexadecimal if
          a `0x' prefix is present.

          Default: `dec'.

    `ios::fixed'
          Avoid scientific notation, and always show a fixed number of
          digits after the decimal point, according to the output
          precision in effect.  Use `ios::precision' to set precision.

    `ios::left'
    `ios::right'
    `ios::internal'
          Where output is to appear in a fixed-width field;
          left-justified, right-justified, or with padding in the
          middle (e.g. between a numeric sign and the associated
          value), respectively.

    `ios::scientific'
          Use scientific (exponential) notation to display numbers.

    `ios::showbase'
          Display the conventional prefix as a visual indicator of the
          conversion base: no prefix for decimal, `0' for octal, `0x'
          for hexadecimal.

    `ios::showpoint'
          Display a decimal point and trailing zeros after it to fill
          out numeric fields, even when redundant.

    `ios::showpos'
          Display a positive sign on display of positive numbers.

    `ios::skipws'
          Skip white space.  (On by default).

    `ios::stdio'
          Flush the C `stdio' streams `stdout' and `stderr' after each
          output operation (for programs that mix C and C++ output
          conventions).

    `ios::unitbuf'
          Flush after each output operation.

    `ios::uppercase'
          Use upper-case characters for the non-numeral elements in
          numeric displays; for instance, `0X7A' rather than `0x7a', or
          `3.14E+09' rather than `3.14e+09'.

 - Method: fmtflags ios::flags (fmtflags VALUE)
     Set VALUE as the complete collection of flags controlling the
     format state.  The flag values are described under `ios::flags ()'.

     Use `ios::setf' or `ios::unsetf' to change one property at a time.

 - Method: fmtflags ios::setf (fmtflags FLAG)
     Set one particular flag (of those described for `ios::flags ()';
     return the complete collection of flags _previously_ in effect.
     (Use `ios::unsetf' to cancel.)

 - Method: fmtflags ios::setf (fmtflags FLAG, fmtflags MASK)
     Clear the flag values indicated by MASK, then set any of them that
     are also in FLAG.  (Flag values are described for `ios::flags
     ()'.)  Return the complete collection of flags _previously_ in
     effect.  (See `ios::unsetf' for another way of clearing flags.)

 - Method: fmtflags ios::unsetf (fmtflags FLAG)
     Make certain FLAG (a combination of flag values described for
     `ios::flags ()') is not set for this stream; converse of
     `ios::setf'.  Returns the old values of those flags.


automatically generated by info2www version 1.2.2.9