filebuf::seekoff | virtual protected member function |
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
Sets a new position to the position pointers specified by parameter which. This position is made from an offset value (off) relative to a given direction (way).
If the which parameter includes ios_base::in, the get pointer gptr is affected, and if the which parameter includes ios_base::out, the put pointer pptr. Both position pointers can be affected by a single call.
This member function overrides the virtual member streambuf::seekoff, which is called by member streambuf::pubseekoff.
Parameters
- off
- Offset value. This is relative to the way parameter.
It is a value of type streamoff. - 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
- Determines which of the internal position pointers shall be modified: the input pointer, the output 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:
value position pointer affected ios_base::in Modify get pointer position ios_base::out Modify put pointer position
Return Value
The new position value of the modified position pointer. If the position was invalid, the function returns a value of -1 to signal failure.Basic template member declaration
( basic_filebuf<charT,traits,Allocator> )typedef traits::pos_type pos_type; typedef traits::off_type off_type; pos_type seekoff (off_type off, ios_base::seekdir way, ios_base which = ios_base::in | ios_base::out ); |
See also
filebuf::seekpos | Set internal position pointer to absolute position (virtual protected member function) |
streambuf::pubseekoff | Set internal position pointer to relative position (public member function) |