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

请参见

参考

basic_streambuf 类

iostream 编程

iostreams 约定