共用方式為


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 Class

iostream 程式設計

iostreams 慣例