แก้ไข

แชร์ผ่าน


<ios>

Defines several types and functions basic to the operation of iostreams. This header is typically included for you by another iostream headers; you rarely include it directly.

Requirements

Header: <ios>

Namespace: std

Note

The <ios> library uses the #include <iosfwd> statement.

Remarks

A large group of functions are manipulators. A manipulator declared in <ios> alters the values stored in its argument object of class ios_base. Other manipulators perform actions on streams controlled by objects of a type derived from this class, such as a specialization of one of the class templates basic_istream or basic_ostream. For example, noskipws(str) clears the format flag ios_base::skipws in the object str, which can be of one of these types.

You can also call a manipulator by inserting it into an output stream or extracting it from an input stream, because of special insertion and extraction operations supplied for the classes derived from ios_base. For example:

istr>> noskipws;

calls noskipws(istr).

Members

Typedefs

Name Description
ios Supports the ios class from the old iostream library.
streamoff Supports internal operations.
streampos Holds the current position of the buffer pointer or file pointer.
streamsize Specifies the size of the stream.
wios Supports the wios class from the old iostream library.
wstreampos Holds the current position of the buffer pointer or file pointer.

Manipulators

Name Description
boolalpha Specifies that variables of type bool appear as true or false in the stream.
dec Specifies that integer variables appear in base 10 notation.
defaultfloat Configures the flags of an ios_base object to use a default display format for float values.
fixed Specifies that a floating-point number is displayed in fixed-decimal notation.
hex Specifies that integer variables appear in base 16 notation.
hexfloat
internal Causes a number's sign to be left justified and the number to be right justified.
left Causes text that is not as wide as the output width to appear in the stream flush with the left margin.
noboolalpha Specifies that variables of type bool appear as 1 or 0 in the stream.
noshowbase Turns off indicating the notational base in which a number is displayed.
noshowpoint Displays only the whole-number part of floating-point numbers whose fractional part is zero.
noshowpos Causes positive numbers to not be explicitly signed.
noskipws Cause spaces to be read by the input stream.
nounitbuf Causes output to be buffered and processed when the buffer is full.
nouppercase Specifies that hexadecimal digits and the exponent in scientific notation appear in lowercase.
oct Specifies that integer variables appear in base 8 notation.
right Causes text that is not as wide as the output width to appear in the stream flush with the right margin.
scientific Causes floating point numbers to be displayed using scientific notation.
showbase Indicates the notational base in which a number is displayed.
showpoint Displays the whole-number part of a floating-point number and digits to the right of the decimal point even when the fractional part is zero.
showpos Causes positive numbers to be explicitly signed.
skipws Cause spaces to not be read by the input stream.
unitbuf Causes output to be processed when the buffer is not empty.
uppercase Specifies that hexadecimal digits and the exponent in scientific notation appear in uppercase.

Error Reporting

Name Description
io_errc
is_error_code_enum
iostream_category
make_error_code
make_error_condition

Classes

Name Description
basic_ios The class template describes the storage and member functions common to both input streams (of class template basic_istream) and output streams (of class template basic_ostream) that depend on the template parameters.
fpos The class template describes an object that can store all the information needed to restore an arbitrary file-position indicator within any stream.
ios_base The class describes the storage and member functions common to both input and output streams that do not depend on the template parameters.

See also

Header Files Reference
Thread Safety in the C++ Standard Library
iostream Programming
iostreams Conventions