protected virtual member function
<streambuf> <iostream>
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
Virtual function called by the public member function pubseekoff 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 a position offset off relative to the direction specified by way.
Parameters
- off
- Offset value, relative to the way parameter.
streamoff is a signed integral type.
- way
- Object of type ios_base::seekdir. It may take any of the following constant values:
value | offset is relative to... |
ios_base::beg | beginning of the stream buffer |
ios_base::cur | current position in the stream buffer |
ios_base::end | end of the stream buffer |
- 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 |
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::pubseekoff
- Set internal position pointer to relative position (public member function)
- filebuf::seekoff
- Set internal position to relative position (protected virtual member function)
- stringbuf::seekoff
- Set position pointer to relative position (protected virtual member function)