protected virtual member function
<fstream>

std::basic_filebuf::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 internal position pointers specified by parameter which.

If which includes out, the function also writes any unwritten characters in the intermediate output buffer to the file (also calling unshift using the proper facet, when needed).

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 internal position pointers is affected: the input position, the output position, 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 input position, and its corresponding get pointer (gptr)
ios_base::outModifies the output position and its corresponding put pointer (pptr)
Both positions 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_filebuf object.
Concurrent access to the same file stream buffer object may introduce data races.

Exception safety

Basic guarantee: if an exception is thrown, the file stream buffer is in a valid state.

See also