Standard C++ Library Reference ISO/IEC (VERSION3)
basic_stringbuf::seekoff
virtual pos_type seekoff(off_type off,
ios_base::seekdir way,
ios_base::openmode mode =
ios_base::in | ios_base::out);
The protected virtual member function endeavors to alter the current positions for the controlled
streams. For an object of class basic_stringbuf<Elem, Tr, Alloc>, a stream
position consists purely of a stream offset. Offset zero designates the first element of the
controlled sequence.
The new position is determined as follows:
If way == ios_base::beg, the new position is the beginning of the stream plus
off.
●
If way == ios_base::cur, the new position is the current stream position plus
off.
●
If way == ios_base::end, the new position is the end of the stream plus off.●
If mode & ios_base::in is nonzero, the function alters the next position to read in the
input buffer. If mode & ios_base::out is nonzero, the function alters the next position to
write in the output buffer. For a stream to be affected, its buffer must exist. For a positioning
operation to succeed, the resulting stream position must lie within the controlled sequence. If
the function affects both stream positions, way must be ios_base::beg or
ios_base::end and both streams are positioned at the same element. Otherwise (or if
neither position is affected) the positioning operation fails.
If the function succeeds in altering either or both of the stream positions, it returns the resultant
stream position. Otherwise, it fails and returns an invalid stream position.
basic_stringbuf::seekpos
virtual pos_type seekpos(pos_type sp,
ios_base::openmode mode =
ios_base::in | ios_base::out);
The protected virtual member function endeavors to alter the current positions for the controlled
streams. For an object of class basic_stringbuf<Elem, Tr, Alloc>, a stream
position consists purely of a stream offset. Offset zero designates the first element of the
controlled sequence. The new position is determined by sp.
If mode & ios_base::in is nonzero, the function alters the next position to read in the
input buffer. If mode & ios_base::out is nonzero, the function alters the next position to
write in the output buffer. For a stream to be affected, its buffer must exist. For a positioning
operation to succeed, the resulting stream position must lie within the controlled sequence.