std::basic_stringbuf<CharT,Traits,Allocator>::setbuf

If s is a null pointer and n is zero, this function has no effect.

# Declarations

protected:
virtual std::basic_streambuf<CharT, Traits>* setbuf( char_type* s, std::streamsize n )

# Parameters

# Return value

this

# Notes

The deprecated stream buffer std::strstreambuf or the boost.IOStreams device boost::basic_array may be used to implement I/O buffering over a user-provided char array in portable manner.

# Example

#include <iostream>
#include <sstream>
 
int main()
{
    std::ostringstream ss;
    char c[1024] = {};
    ss.rdbuf()->pubsetbuf(c, 1024);
    ss << 3.14 << '\n';
    std::cout << c << '\n';
}

# See also