basic_streambuf::sputn
将字符字符串到流中。
streamsize sputn(
const char_type *_Ptr,
streamsize _Count
);
参数
_Ptr
字符串。_Count
计数字符。
返回值
字符数实际插入到流中。
备注
成员函数返回 xsputn(_Ptr,_Count)。 请参见此成员的"备注"节有关更多信息。
示例
// basic_streambuf_sputn.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>
int main()
{
using namespace std;
streamsize i = cout.rdbuf()->sputn("test", 4);
cout << endl << i << endl;
}
要求
标头: <streambuf>
命名空间: std