Cpp Standard Library 简明教程
C++ Library - <ostream>
Introduction
它是一个输出流对象,可以写入字符序列并表示其他类型的数据。提供了特定的成员来执行这些输出操作。
It is an output stream objects can write sequences of characters and represent other kinds of data. Specific members are provided to perform these output operations.
Definition
下面是std::ostream的定义。
Below is definition of std::ostream.
typedef basic_ostream<char> ostream;
Parameters
-
charT − Character type.
-
traits − Character traits class that defines essential properties of the characters used by stream objects.
Member types
Sr.No. |
Member types |
Definition |
1 |
Type to indicate event type |
|
2 |
Event callback function type |
|
3 |
Base class for stream exceptions |
|
4 |
Type for stream format flags |
|
5 |
Initialize standard stream objects |
|
6 |
Type for stream state flags |
|
7 |
Type for stream opening mode flags |
|
8 |
Type for stream seeking direction flag |
|
9 |
It is used to prepare stream for input |
|
10 |
It is used to prepare stream for output |
Public Member Functions
Sr.No. |
Member types |
Definition |
1 |
Construct object (public member function ) |
|
2 |
Destruct object (public member function ) |
Public member functions
Sr.No. |
Member Functions |
Definition |
1 |
It is used to get character count |
|
2 |
It is used to get characters |
|
3 |
It is used to get line |
|
4 |
It is used to extract and discard characters |
|
5 |
It is used to peek next character |
|
6 |
It is used to read block of data |
|
7 |
It is used to Read data available in buffer |
|
8 |
It is used to put character back |
|
9 |
It is used to unget character |
Unformatted output
Sr.No. |
Output |
Definition |
1 |
It is used to put character |
|
2 |
It is used to write block of data |
Positioning
Sr.No. |
Position |
Definition |
1 |
It is used to get position in output sequence |
|
2 |
It is used to set position in output sequence |
Protected member functions
Sr.No. |
Member Functions |
Definition |
1 |
[role="bare"]../cpp_standard_library/cpp_basic_ios_operator_equal.html |
It is used to move assignment |
2 |
It is used to swap internals |
Public member functions inherited from basic_ios
Sr.No. |
Member types |
Definition |
1 |
It is used to check whether state of stream is good |
|
2 |
It is used to check whether eofbit is set |
|
3 |
It is used to check whether either failbit or badbit is set |
|
4 |
It is used to check whether badbit is set |
|
5 |
Evaluate stream |
|
6 |
It is used to get error state flags |
|
7 |
It is used to set error state flag |
|
8 |
It is used to set error state flag |
|
9 |
Get/set fill character |
|
10 |
It is used to get/set exceptions mask |
|
11 |
Imbue locale |
|
12 |
It is used to get/set tied stream |
|
13 |
It is used to get/set stream buffer |
|
14 |
Narrow character |
|
15 |
Widen character |