std::basic_spanbuf<CharT,Traits>::seekoff - cppreference.com (original) (raw)

Repositions the next pointer to get and/or put area, if possible, to the position that corresponds to exactly off characters from beginning, end, or current position of the get and/or put area of the buffer.

Let _n_ be the number of CharT elements in underlying buffer, or ​0​ when there is no underlying buffer, this function fails if

_newoff_ is computed as below:

This function repositions the next pointer to get and/or put area to pbuf + newoff on success if std::ios_base::in and/or std::ios_base::out is correspondingly set in which, where _pbuf_ is the pointer to the beginning of the underlying buffer, or the null pointer value if there is no underlying buffer.

[edit] Parameters

off - relative position to set the next pointer(s) to
dir - defines base position to apply the relative offset to. It can be one of the following constants: Constant Explanation beg the beginning of a stream end the ending of a stream cur the current position of stream position indicator
which - defines whether the input sequences, the output sequence, or both are affected. It can be one or a combination of the following constants: Constant Explanation in affect the input sequence out affect the output sequence

[edit] Return value

pos_type(newoff) on success, pos_type(off_type(-1)) on failure.

[edit] Example

[edit] See also

| | repositions the next pointer in the input sequence, output sequence, or both, using relative addressing (virtual protected member function of std::basic_stringbuf<CharT,Traits,Allocator>) [edit] | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | repositions the next pointer in the input sequence, output sequence, or both, using relative addressing (virtual protected member function of std::strstreambuf) [edit] |