protected virtual member function
<sstream>

std::basic_stringbuf::seekpos

pos_type seekpos (pos_type pos, ios_base::openmode which = ios_base::in | ios_base::out);
Set position pointer to absolute position
Sets the absolute new position pos for the position pointers specified by parameter which.

If which includes ios_base::in, the get pointer (gptr) is affected, and if which includes ios_base::out, the put pointer (pptr). Both position pointers can be affected by a single call.

This virtual function is called by the public member basic_streambuf::pubseekpos.

Parameters

pos
New absolute position for the position pointer.
Member type pos_type is determined by the character traits: generally, it is an fpos type (such as streampos) that can be converted to/from integral types.
which
Determines which of the position pointers is affected: the get pointer, the put pointer, or both. It is an object of type ios_base::openmode that, for this function, may take any combination of the following significant constant values:
valueposition pointer affected
ios_base::inModifies the get pointer (gptr)
ios_base::outModifies the put pointer (pptr)
Both pointers may be selected simultaneously.

Return Value

On success, it returns pos.
On failure, the function returns pos_type(off_type(-1)).
Member type pos_type is determined by the character traits: generally, it is an fpos type (such as streampos) that can be converted to/from integral types.

Data races

Modifies the basic_stringbuf object.
Concurrent access to the same object may cause data races.

Exception safety

Basic guarantee: if an exception is thrown, the object is in a valid state.

See also