std::basic_streambuf::xsputn
性病:基本[医]Streambuf::span,std::basic[医]流光::xspunn
std::streamsize sputn( const char_type* s, std::streamsize count | (1) | |
---|---|---|
protected: virtual std::streamsize xsputn( const char_type* s, std::streamsize count | (2) | |
1%29次电话xsputn(s, count)
最派生的类。
2%29写count
指向其第一个元素的字符数组的输出序列的字符。s
.这些字符的书写方式就好像是通过反复调用sputc()
.写作在任何一种情况下都会停止count
字符被写入或调用sputc()
会回来的Traits::eof()
...
如果放置区域变成满的%28pptr() == epptr()
%29,此函数可调用overflow()
,或达到调用的效果。overflow()
其他的,没有具体说明的,意思是。
参数
%280%29
返回值
成功写入的字符数。
例
二次
#include <iostream>
#include <sstream>
int main()
{
std::ostringstream s1;
std::streamsize sz = s1.rdbuf()->sputn("This is a test", 14
s1 << '\n';
std::cout << "The call to sputn() returned " << sz << '\n'
<< "The output sequence contains " << s1.str(
std::istringstream s2;
sz = s2.rdbuf()->sputn("This is a test", 14
std::cout << "The call to sputn() on an input stream returned " << sz << '\n';
}
二次
产出:
二次
The call to sputn() returned 14
The output sequence contains This is a test
The call to sputn() on an input stream returned 0
二次
另见
sgetn | invokes xsgetn() (public member function) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。