Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
IOstream Library
manipulators
classes:
filebuf
fstream
ifstream
ios
iostream
ios_base
istream
istringstream
ofstream
ostream
ostringstream
streambuf
stringbuf
stringstream
objects:
cerr
cin
clog
cout
types:
fpos
streamoff
streampos
streamsize
streambuf
streambuf::streambuf
streambuf::~streambuf
public members:
streambuf::getloc
streambuf::in_avail
streambuf::pubimbue
streambuf::pubseekoff
streambuf::pubseekpos
streambuf::pubsetbuf
streambuf::pubsync
streambuf::sbumpc
streambuf::sgetc
streambuf::sgetn
streambuf::snextc
streambuf::sputbackc
streambuf::sputc
streambuf::sputn
streambuf::sungetc
protected members:
streambuf::eback
streambuf::egptr
streambuf::epptr
streambuf::gbump
streambuf::gptr
streambuf::pbase
streambuf::pbump
streambuf::pptr
streambuf::setg
streambuf::setp
virtual prot. members:
streambuf::imbue
streambuf::overflow
streambuf::pbackfail
streambuf::seekoff
streambuf::seekpos
streambuf::setbuf
streambuf::showmanyc
streambuf::sync
streambuf::uflow
streambuf::underflow
streambuf::xsgetn
streambuf::xsputn


streambuf::xsgetn

virtual protected member function
streamsize xsgetn ( char * s, streamsize n );

Get sequence of characters

Gets up to n characters from the input sequence and stores them in the array pointed by s.

If less than n characters are available in the input sequence the function returns all the available characters, as if successive calls to sbumpc were made until an EOF (or traits::eof() for other traits) was returned.

This is a virtual member function that can be redefined for a specific behavior in derived classes. Its default behavior in streambuf is to perform the expected behavior by calling repeatedly the member function sbumpc, but this may be overriden for more efficient implementations in derived classes (neither filebuf nor stringbuf do, though).

Parameters

s
Pointer to a block of memory where the character sequence is to be stored.
n
Number of characters to be gotten. This is an integer value of type streamsize.

Return Value

The number of characters gotten, returned as a value of type streamsize.

Basic template member declaration

( basic_streambuf<charT,traits> )
1
2
typedef charT char_type;
streamsize xsgetn (char_type * s, streamsize n);


See also