C++ streambuf - seekpos



Description

It is used to set position pointer to absolute position and sets the absolute new position pos for the position pointers specified by parameter which.

Declaration

Following is the declaration for std::stringbuf::seekpos.

streampos seekpos (streampos sp, ios_base::openmode which = ios_base::in | ios_base::out);

Parameters

  • pos − New absolute position for the position pointer.

  • way − It determines which of the position pointers is affected: the get pointer.

Return Value

It returns pos on success or the function returns streampos(streamoff(-1))on failure.

Exceptions

Basic guarantee − if an exception is thrown, the object is in a valid state.

Data races

it modifies the stringbuf object.

streambuf.htm
Advertisements