Partager via


basic_streambuf::sputn

Puts a character string into the stream.

streamsize sputn(
   const char_type *_Ptr,
   streamsize _Count
);

Parameters

  • _Ptr
    The character string.

  • _Count
    The count of characters.

Return Value

The number of characters actually inserted into the stream.

Remarks

The member function returns xsputn(_Ptr, _Count). See the Remarks section of this member for more information.

Example

// 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;
}

test
4

Requirements

Header: <streambuf>

Namespace: std

See Also

Concepts

basic_streambuf Class

basic_streambuf Members

iostream Programming

iostreams Conventions