C++ streambuf - seekoff



Description

It is used to set position pointer to relative position and sets a new position to the position pointers specified by parameter which. This position is calculated as an offset of off characters relative to a the origin specified by way.

Declaration

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

streampos seekoff (streamoff off, ios_base::seekdir way,
                  ios_base::openmode which = ios_base::in | ios_base::out);

Parameters

  • off − It is an offset value.

  • way − It is an object of type ios_base::seekdir.

Return Value

It returns the new absolute position the position pointer points to after the call, if representable as a value of type streampos on success or if the above is not possible, the function returns streampos(streamoff(-1)). streampos is a positioning type that can be converted to/from integral types 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