streambuf::seekpos

Syntax

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

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.

Return Value

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

See Also

streambuf::seekoff