protected virtual member function
<streambuf> <iostream>
streampos seekpos (streampos sp, ios_base::openmode which = ios_base::in | ios_base::out);
Set internal position pointer to absolute position
Virtual function called by the public member function pubseekpos to alter the stream positions of one or more of the controlled sequences in a specific way for each derived class.
Its default behavior in streambuf is to do nothing and return -1
, but derived classes shall override this behavior to alter the internal pointers appropriately: both filebuf and stringbuf override this virtual member function to set the internal pointer specified by which to the absolute position pos.
Parameters
- pos
- New absolute position for the position pointer.
streampos is a positioning type that can be converted to/from integral types (an fpos type).
- which
- Generally used to determine the position on which of the controlled sequences shall be modified: the input sequence, the output sequence, 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:
value | position pointer affected |
ios_base::in | Modify current position in controlled input sequence |
ios_base::out | Modify current position in controlled output sequence |
Return Value
Returns pos_type(off_type(-1))
.
streampos is a positioning type that can be converted to/from integral types (an fpos type).
Data races
Introduces no data races, but overriden versions in derived classes may.
Exception safety
No-throw guarantee: this default definition never throws exceptions.
See also
- streambuf::pubseekpos
- Set internal position pointer to absolute position (public member function)
- filebuf::seekpos
- Set position pointer to absolute position (protected virtual member function)
- stringbuf::seekpos
- Set position pointer to absolute position (protected virtual member function)