std::basic_streambuf<CharT,Traits>::sputn,std::basic_streambuf<CharT,Traits>::xsputn (3) - Linux Manuals
std::basic_streambuf<CharT,Traits>::sputn,std::basic_streambuf<CharT,Traits>::xsputn: std::basic_streambuf<CharT,Traits>::sputn,std::basic_streambuf<CharT,Traits>::xsputn
NAME
std::basic_streambuf<CharT,Traits>::sputn,std::basic_streambuf<CharT,Traits>::xsputn - std::basic_streambuf<CharT,Traits>::sputn,std::basic_streambuf<CharT,Traits>::xsputn
Synopsis
std::streamsize sputn( const char_type* s, std::streamsize count ); (1)
protected: (2)
virtual std::streamsize xsputn( const char_type* s, std::streamsize count );
1) Calls xsputn(s, count) of the most derived class.
2) Writes count characters to the output sequence from the character array whose first element is pointed to by s. The characters are written as if by repeated calls to sputc(). Writing stops when either count characters are written or a call to sputc() would have returned Traits::eof().
If the put area becomes full (pptr() == epptr()), this function may call overflow(), or achieve the effect of calling overflow() by some other, unspecified, means.
Parameters
(none)
Return value
The number of characters successfully written.
Notes
"achieving effects of overflow() by unspecified means" permits bulk I/O without intermediate buffering: that's how std::ofstream::write simply passes the pointer to the POSIX write() system call in some implementations of iostreams
Example
// Run this code
Output:
See also
sgetn (public member function)