std::cout, std::wcout
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <iostream>
|
||
| extern std::ostream cout; |
(1) | |
| extern std::wostream wcout; |
(2) | |
全局对象std::cout和std::wcout控制的实现定义类型(来自std::streambuf),与标准的C输出流输出到一个流缓冲stdout.
Original:
The global objects std::cout and std::wcout control output to a stream buffer of implementation-defined type (derived from std::streambuf), associated with the standard C output stream stdout.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
保证这些对象被称为以前建造的第一个构造函数中的静态对象,保证他们活得比最后的静态对象的析构函数,因此,它始终是在用户代码中写std::cout.
Original:
These objects are guaranteed to be constructed before the first constructor of a static object is called and they are guaranteed to outlive the last destructor of a static object, so that it is always possible to write to std::cout in user code.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
除非sync_with_stdio(false)已经发出,它是安全的格式化和未格式化的输出都从多个线程同时访问这些对象.
Original:
Unless sync_with_stdio(false) has been issued, it is safe to concurrently access these objects from multiple threads for both formatted and unformatted output.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
初始化完成后,std::cout搭配()'d到std::cin和std::wcout领带()'Dstd::wcin,这意味着任何输入操作std::cin执行std::cout.flush()(通过std::basic_istream::sentry的构造函数).
Original:
Once initialized, std::cout is tie()'d to std::cin and std::wcout is tie()'d to std::wcin, meaning that any input operation on std::cin executes std::cout.flush() (via std::basic_istream::sentry's constructor).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
初始化完成后,std::cout还配合()'d到std::cerr和std::wcout搭配()'Dstd::wcerr,这意味着任何输出操作std::cerr执行std::cout.flush()(通过std::basic_ostream::sentry的构造函数)(C++11 起)
Original:
Once initialized, std::cout is also tie()'d to std::cerr and std::wcout is tie()'d to std::wcerr,, meaning that any output operation on std::cerr executes std::cout.flush() (via std::basic_ostream::sentry's constructor) (C++11 起)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 为例
Output:
static constructor main function static destructor
[编辑] 另请参阅
| 标准流对象进行初始化 Original: initializes standard stream objects The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员类of std::ios_base)
| |
| 写入标准的C错误流stderr
(全局对象) Original: writes to the standard C error stream stderr (全局对象) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| cout wcout |
写入标准C的输出流stdout
(全局对象)的 Original: writes to the standard C output stream stdout (全局对象) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |