名前空間
変種
操作

std::cerr, std::wcerr

提供: cppreference.com
< cpp‎ | io

 
 
入力/出力ライブラリ
I / Oのマニピュレータ
CスタイルのI / O
バッファ
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(廃止予定)
ストリーム
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽象化
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
ファイルI / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
文字列I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
アレイのI / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(廃止予定)
ostrstream(廃止予定)
strstream(廃止予定)
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
エラーカテゴリインターフェース
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_ostream
グローバルオブジェクト
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cerr
wcerr
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::basic_ostream
basic_ostream::~basic_ostream
basic_ostream::operator=(C++11)
書式付き入力
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::operator<<
書式なし入力
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::put
basic_ostream::write
ポジショニング
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::tellp
basic_ostream::seekp
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::flush
basic_ostream::swap(C++11)
メンバークラス
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::sentry
非メンバ関数
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator<<(std::basic_ostream)
 
Defined in header <iostream>
extern std::ostream cerr;
(1)
extern std::wostream wcerr;
(2)
グローバルオブジェクトstd::cerrstd::wcerr標準Cエラー出力ストリームに関連付けられている実装定義型(std::streambufstd::wstreambuf、それぞれに由来する)のストリームバッファへの制御出力stderr.
Original:
The global objects std::cerr and std::wcerr control output to a stream buffer of implementation-defined type (derived from std::streambuf and std::wstreambuf, respectively), associated with the standard C error output stream stderr.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
これらのオブジェクトは、静的オブジェクトの最初のコンストラクタが呼び出される前に建設されることが保証されて、彼らは、それがユーザーコードでstd::cerrに書き込みすることは常に可能であるように、静的オブジェクトの最後のデストラクタよりも長生きすることが保証されています.
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::cerr 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.
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.
これらのストリーム·オブジェクトに送信されたすべての出力は直ちにOSにフラッシュされていることをいったん初期化されると、std::cerr.flags() & unitbuf != 0wcerrも同様)意味(std::basic_ostream::sentryのデストラクターを経由して).
Original:
Once initialized, std::cerr.flags() & unitbuf != 0 (same for wcerr) meaning that any output sent to these stream objects is immediately flushed to the OS (via std::basic_ostream::sentry's destructor).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::cerr.tie()上の任意の出力操作では、最初の&std::coutwcerrのコンストラクタ経由)wcoutを実行することを意味するだけでなく、std::cerr返しstd::cout.flush()std::basic_ostream::sentry(C + + 11以来)も同様)
Original:
In addition, std::cerr.tie() returns &std::cout (same for wcerr and wcout), meaning that any output operation on std::cerr first 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.

[編集]

coutに保留中の出力のうちcerrをフラッシュし経由してstderrに出力、下駄経由stderrへの出力はしませんが
Original:
output to stderr via cerr flushes out the pending output on cout, while output to stderr via clog does not
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <thread>
#include <iostream>
#include <chrono>
void f()
{
    std::cout << "Output from thread...";
    std::this_thread::sleep_for(std::chrono::seconds(2));
    std::cout << "...thread calls flush()" << std::endl;
}
 
int main()
{
    std::thread t1(f);
    std::this_thread::sleep_for(std::chrono::seconds(1));
    std::clog << "This output from main is not tie()'d to cout\n";
    std::cerr << "This output is tie()'d to cout\n";
    t1.join();
}

Output:

This output from main is not tie()'d to cout
Output from thread...This output is tie()'d to cout
...thread calls flush()

[編集] も参照してください

標準ストリームオブジェクトを初期化します
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.

(publicメンバクラスof std::ios_base) [edit]
標準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.
[edit]
標準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.
[edit]