std::basic_streambuf<CharT,Traits>:: sputc
| I/O manipulators | ||||
| Print functions (C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(C++20)
|
||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
| Synchronized Output | ||||
|
(C++20)
|
||||
| Types | ||||
| Error category interface | ||||
|
(C++11)
|
||||
|
(C++11)
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
int_type sputc
(
char_type ch
)
;
|
||
向输出序列写入一个字符。
如果输出序列写入位置不可用(缓冲区已满),则调用 overflow ( ch ) 。
目录 |
参数
| ch | - | 要写入的字符 |
返回值
成功时,将写入的字符通过
Traits
::
to_int_type
(
ch
)
转换为
int_type
。
Traits :: eof ( ) (由 overflow() 返回)表示操作失败。
示例
#include <iostream> #include <sstream> int main() { std::ostringstream s; s.rdbuf()->sputc('a'); std::cout << s.str() << '\n'; }
输出:
a
参见
|
调用
xsputn
(
)
(公开成员函数) |