cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : IOstream Library : stringbuf : seekoff
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
IOstream Library
manipulators
classes:
· filebuf
· fstream
· ifstream
· ios
· iostream
· ios_base
· istream
· istringstream
· ofstream
· ostream
· ostringstream
· streambuf
· stringbuf
· stringstream
objects:
· cerr
· cin
· clog
· cout
types:
· fpos
· streamoff
· streampos
· streamsize
stringbuf
· stringbuf::stringbuf
public members:
· stringbuf::str
virtual members:
· stringbuf::overflow
· stringbuf::pbackfail
· stringbuf::seekoff
· stringbuf::seekpos
· stringbuf::setbuf
· stringbuf::underflow

-

stringbuf::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:
valueoffset is relative to...
ios_base::begbeginning of the stream buffer
ios_base::curcurrent position in the stream buffer
ios_base::endend 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:
valueposition pointer affected
ios_base::inModify get pointer position
ios_base::outModify 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_stringbuf<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

stringbuf::seekpos Set internal position pointer to absolute position (virtual protected member function)
streambuf::pubseekoff Set internal position pointer to relative position (public member function)

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us