std::basic_ostream::put
提供:cppreference.com
< cpp | io | basic ostream
|
|
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. |
| basic_ostream& put( char_type ch ); |
||
文字
chは、出力ストリームへの書き込み.Original:
Writes character
ch to the output stream.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.
この関数は、書式なし出力関数である:それはどのフラッシュし
sentry'd出力バッファが必要であれば、型tie()のオブジェクトを作成することにより、実行を開始し、ストリームのエラーをチェックします。建設後、false監視オブジェクトを返した場合、この関数は、任意の出力をしようとせずに返します。例外が出力時にスローされた場合、その後はios :: badbitをは(exceptions()&badbit) != 0が、その場合、それがスローされない限り、例外が抑制されている)が設定されますOriginal:
This function is an unformatted output function: it begin execution by constructing an object of type
sentry, which flushes the tie()'d output buffers if necessary and checks the stream errors. After construction, if the sentry object returns false, the function returns without attempting any output. If an exception is thrown during output, then ios::badbit is set (the exception is suppressed unless exceptions()&badbit) != 0, in which case it is rethrown)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.
目次 |
[編集] パラメータ
| ch | - | 書き込む文字
Original: character to write The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
*this
[編集] ノート
この関数は、signed charまたはunsigned char、フォーマットされた<div class="t-tr-text">演算子<<
違って種類のオーバーロードされていませんOriginal:
operator<<
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
Original:
This function is not overloaded for the types signed char or unsigned char, unlike the formatted
演算子<<</div>
Original:
operator<<
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
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.
出力が失敗した場合は書式付き出力関数とは異なり、この関数は
failbitを設定することはありません.Original:
Unlike formatted output functions, this function does not set the
failbit if the output fails.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.
[編集] 例
#include <fstream> #include <iostream> int main() { std::cout.put('a'); // normal usage std::cout.put('\n'); std::ofstream s("/does/not/exist/"); s.clear(); // pretend the stream is good std::cout << "Unformatted output: "; s.put('c'); // this will set badbit, but not failbit std::cout << " fail=" << bool(s.rdstate() & s.failbit); std::cout << " bad=" << s.bad() << '\n'; s.clear(); std::cout << "Formatted output: "; s << 'c'; // this will set badbit and failbit std::cout << " fail=" << bool(s.rdstate() & s.failbit); std::cout << " bad=" << s.bad() << '\n'; }
Output:
a Unformatted output: fail=0 bad=1 Formatted output: fail=1 bad=1
[編集] も参照してください
| 挿入文字データを Original: inserts character data The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (機能) | |
| 挿入文字のブロックを Original: inserts blocks of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |