首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::basic_streambuf::sputc

int_type sputc( char_type ch );

将一个字符写入输出序列。

如果输出序列写入位置不可用--缓冲区为%29,则调用overflow(ch)...

参数

ch

-

character to write

返回值

文字字符,转换为int_type带着Traits::to_int_type(ch)关于成功。

Traits::eof()28名overflow()%29失败。

二次

代码语言:javascript
复制
#include <iostream>
#include <sstream>
 
int main()
{
    std::ostringstream s;
    s.rdbuf()->sputc('a');
    std::cout << s.str() << '\n';
}

二次

产出:

二次

代码语言:javascript
复制
a

二次

另见

sputn

invokes xsputn() (public member function)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券