streambuf::seekpos

virtual streampos seekpos( streampos pos, int nMode = ios::in | ios::out );

Return Value

The new position value. If both ios::in and ios::out are specified, the function returns the output position. If the derived class does not support positioning, the function returns EOF.

Parameters

pos

The new position value; streampos is a typedef equivalent to long.

nMode

An integer that contains mode bits defined as ios enumerators that can be combined with the OR ( | ) operator. See ofstream::ofstream for a listing of the enumerators.

Remarks

Changes the position, relative to the beginning of the stream, for the streambuf object. Not all derived classes of streambuf need to support positioning; however, the filebuf, strstreambuf, and stdiobuf classes do support positioning.

Classes derived from streambuf often support independent input and output position values. The nMode parameter determines which value(s) is set.

Default Implementation

Calls seekoff( (streamoff) pos, ios::beg, nMode ). Thus, to define seeking in a derived class, it is usually necessary to redefine only seekoff.

streambuf OverviewStream Buffer Classes

See Also   streambuf::seekoff