std::basic_stringbuf::setbuf
提供: cppreference.com
< cpp | io | basic stringbuf
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
protected: virtual std::basic_streambuf<CharT, Traits>* setbuf( char_type* s, std::streamsize n ) |
||
s
がNULLポインターであるとn
がゼロの場合、この関数は何の効果もありません.Original:
If
s
is a null pointer and n
is zero, this function has no effect.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::stringメンバーをクリアして、最初の要素が
n
によって指されているサイズs
ユーザー提供の文字配列を、使用を開始しながら、としてバッファおよび入力/出力文字シーケンス.Original:
Otherwise, the effect is implementation-defined: some implementations do nothing, while some implementations clear the std::string member currently used as the buffer and begin using the user-supplied character array of size
n
, whose first element is pointed to by s
, as the buffer and the input/output character sequence.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.
この関数は、仮想保護されて、それが唯一の
pubsetbuf()
を介して、またはstd::basic_stringbuf
から派生したユーザー定義クラスのメンバ関数から呼ばれるかもしれない.Original:
This function is protected virtual, it may only be called through
pubsetbuf()
or from member functions of a user-defined class derived from std::basic_stringbuf
.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.
目次 |
[編集] パラメータ
s | - | ユーザが提供するバッファまたはnullの最初のバイトへのポインタ
Original: pointer to the first byte in the user-provided buffer or null The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
n | - | ユーザが提供するバッファまたはゼロのバイト数
Original: the number of bytes in the user-provided buffer or zero The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
基底クラスにキャスト*this
std::basic_streambuf
、.Original:
*this, cast to the base class
std::basic_streambuf
.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::strstreambufまたはboost.IOStreamsデバイス
boost::basic_array
は、I / Oは、移植性の高い方法でユーザーが指定したchar配列の上にバッファリングを実装するために使用されるかもしれません.Original:
The deprecated stream buffer std::strstreambuf or the boost.IOStreams device
boost::basic_array
may be used to implement I/O buffering over a user-provided char array in portable manner.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.
[編集] 例
stringstreamをのsetbufは機能をテストします
Original:
Test for the stringstream's setbuf functionality
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 <iostream> #include <sstream> int main() { std::ostringstream ss; char c[1024] = {}; ss.rdbuf()->pubsetbuf(c, 1024); ss << 3.14 << '\n'; std::cout << c << '\n'; }
出力:
3.14 (on GNU g++/libstdc++ and SunPro C++/roguewave) <nothing> (on MS Visual Studio 2010, SunPro C++/stlport4, CLang++/libc++)
[編集] も参照してください
setbuf()を呼び出します Original: invokes setbuf() The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数of std::basic_streambuf )
|