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::seekoff

virtual protected member function
streampos seekoff ( streamoff off, ios_base::seekdir way, ios_base::openmode which = ios_base::in | ios_base::out );

Set internal position pointer to relative position

This member is called to set a new value for the position pointer in streambuf-derived objects. The public member function pubseekoff calls this protected member function to perform this action.

This is a virtual member function that shall be redefined in derived classes to behave as expected by setting the internal pointer specified by which to a position offset off characters relative to the direction way.

Its default behavior in streambuf is to do nothing and return the invalid position -1, but it is redefined in both standard derived classes, filebuf and stringbuf, to behave as expected specifically for each type of buffer (see filebuf::seekoff and stringbuf::seekoff).

Parameters

off
Offset value. This is relative to the way parameter.
It is a value of type streamoff.
way
Object of type ios_base::seekdir. It may take any of the following constant values:

valueoffset is relative to...
ios_base::begbeginning of the stream buffer
ios_base::curcurrent position in the stream buffer
ios_base::endend of the stream buffer
which
Determines which of the internal position pointers shall be modified, either the get pointer (input), the put pointer (output) or both. It is an object of type ios_base::openmode, that may take any combination of the following significant constant values:
valueposition pointer affected
ios_base::inModify get pointer position
ios_base::outModify put pointer position

Return Value

The new position value of the modified position pointer.
Errors are expected to be signaled by an invalid position value, like -1.

Basic template member declaration

( basic_streambuf<charT,traits> )
1
2
3
typedef traits::pos_type pos_type;
typedef traits::off_type off_type;
pos_type seekoff (off_type off, ios_base::seekdir way, ios_base which = ios_base::in | ios_base::out );


See also