GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::basic_streambuf::sputn,std::basic_streambuf::xsputn(3) C++ Standard Libary std::basic_streambuf::sputn,std::basic_streambuf::xsputn(3)

std::basic_streambuf::sputn,std::basic_streambuf::xsputn - std::basic_streambuf::sputn,std::basic_streambuf::xsputn


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.


(none)


The number of characters successfully written.


"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 suitable system call in some implementations of iostreams

// Run this code


#include <iostream>
#include <sstream>


int main()
{
std::ostringstream s1;
std::streamsize sz = s1.rdbuf()->sputn("This is a test", 14);
s1 << '\n';
std::cout << "The call to sputn() returned " << sz << '\n'
<< "The output sequence contains " << s1.str();


std::istringstream s2;
sz = s2.rdbuf()->sputn("This is a test", 14);
std::cout << "The call to sputn() on an input stream returned " << sz << '\n';
}


The call to sputn() returned 14
The output sequence contains This is a test
The call to sputn() on an input stream returned 0


sgetn invokes xsgetn()
(public member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.