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
. See section Changing stream properties using 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.
See section 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.
See section Changing stream properties using 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
setbase
, or any of the manipulators dec
, oct
, or
hex
; see section Changing stream properties using manipulators.)
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
ios::precision
to set precision.
ios::left
ios::right
ios::internal
ios::scientific
ios::showbase
ios::showpoint
ios::showpos
ios::skipws
ios::stdio
stdio
streams stdout
and stderr
after
each output operation (for programs that mix C and C++ output conventions).
ios::unitbuf
ios::uppercase
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.