bsl::basic_stringbuf::seekoff

Set the current input and/or output position relative to whence.

Synopsis

Declared in <bslstl_stringbuf.h>

virtual
basic_stringbuf<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>::pos_type
seekoff(
    off_type offset,
    std::ios_base::seekdir whence,
    std::ios_base::openmode modeBitMask = ios_base::in | ios_base::out);

Description

Set the current input position or the current output position (or both) to the specified offset from the specified whence location. Optionally specify a modeBitMask indicating whether to set the current input position, current output position, or both. If whence is ios_base::beg, set the current position to the indicated offset from the beginning of the stream; if whence is ios_base::end, set the current position to the indicated offset from the end of the stream; and if whence is ios_base::cur, set the current input or output position to the indicated offset from its current position. If whence is ios_base::cur, then modeBitMask may be either ios_base::in or ios_base::out, but not both. Return the offset of the new position on success, and pos_type(off_type(-1)) otherwise.

Return Value

offset of the new position, or pos_type(off_type(-1)) on failure

Parameters

NameDescription
offsetposition offset relative to whence
whencebase position for the seek (beg, cur, or end)
modeBitMaskwhether to adjust the input position, output position, or both