protected virtual member function
<streambuf> <iostream>


basic_streambuf* setbuf (char_type* s, streamsize n);
Set buffer
Virtual function called by the public member function pubsetbuf to influence the object in a specific way for each derived class.

Its default behavior in basic_streambuf is to do nothing and return this, but derived classes can override this behavior to perform specific actions: both basic_filebuf and basic_stringbuf override this virtual member function (see basic_filebuf::setbuf and basic_stringbuf::setbuf).


s, n
Arguments that may be used by overriding functions in derived classes.
Member type char_type is the type of the characters in the stream buffer (the first class template parameter).
streamsize is a signed integral type.

Return Value

Returns this.

Data races

Introduces no data races, but overriden versions in derived classes may.

Exception safety

No-throw guarantee: this default definition never throws exceptions.

See also