std::basic_streambuf<CharT,Traits>:: sputc
From ja.cppreference.net
<
cpp
|
io
|
basic streambuf
|
int_type sputc
(
char_type ch
)
;
|
||
出力シーケンスに1文字を書き込みます。
出力シーケンスの書き込み位置が利用できない場合(バッファが満杯)、 overflow ( ch ) を呼び出します。
目次 |
パラメータ
| ch | - | 書き込む文字 |
戻り値
書き込まれた文字は、成功時に
int_type
に
Traits
::
to_int_type
(
ch
)
で変換されます。
Traits :: eof ( ) 失敗時に overflow() によって返される値。
例
このコードを実行
#include <iostream> #include <sstream> int main() { std::ostringstream s; s.rdbuf()->sputc('a'); std::cout << s.str() << '\n'; }
出力:
a
関連項目
|
xsputnを呼び出す
xsputn
(
)
(公開メンバ関数) |