[#BloombergLP-bdlde-Utf8CheckingInStreamBufWrapper-seekoff]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/Utf8CheckingInStreamBufWrapper.adoc[Utf8CheckingInStreamBufWrapper]::seekoff
:relfileprefix: ../../../
:mrdocs:

Move the position associated with this object according to the specified `offset` and `whence`&colon;

== Synopsis

Declared in `&lt;bdlde&lowbar;utf8checkinginstreambufwrapper&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
virtual
pos&lowbar;type
seekoff(
    off&lowbar;type offset,
    std::ios&lowbar;base::seekdir whence,
    std::ios&lowbar;base::openmode mode) override;
----

== Description

&ast; If `whence` is `bsl&colon;&colon;ios&lowbar;base&colon;&colon;beg`, set the position to `offset` bytes from the beginning&period; &ast; If `whence` is `bsl&colon;&colon;ios&lowbar;base&colon;&colon;cur`, advance the position by `offset` bytes (note that `offset` is signed)&period; &ast; `whence &equals;&equals; bsl&colon;&colon;ios&lowbar;base&colon;&colon;end` is unsupported and a seek fail will result&period;

A seek can fail if

&ast; the object was already in a failed seek state and the seek was not an absolute seek to the beginning, &ast; the object is not bound to a held `streambuf`, &ast; `whence` is not `bsl&colon;&colon;ios&lowbar;base&colon;&colon;beg` or `bsl&colon;&colon;ios&lowbar;base&colon;&colon;cur`, &ast; the destination is negative, &ast; the destination is forward of the current position, or &ast; a seek on the held `streambuf` is necessary and that `streambuf` does not support seeking,

which will put the object into a `failed seek state`&period; When the object is in a failed seek state, `errorStatus()` will equal `k&lowbar;SEEK&lowbar;FAIL` and the object will no longer have a valid position, meaning that input and relative seeks will fail, until the object is made to recover by either calling `reset` or an absolute seek to position 0&period;

If a seek is performed on the held `streambuf`, the specified `mode` will be propagated to it&period; The behavior is undefined unless `bsl&colon;&colon;ios&lowbar;base&colon;&colon;in` is set in `mode`&period; Note that this function is forwarded to by the public method `pubseekoff` in the base class&period;

`seekoff(0, bsl&colon;&colon;ios&lowbar;base&colon;&colon;cur, mode)` is permissible whether the held `streambuf` is seekable or not and will never result in a seek on the held `streambuf`, returning the position in terms of the held `streambuf` if that `streambuf` is seekable and returning the position relative to when the held `streambuf` was bound to this object otherwise&period;

Some non&hyphen;zero seeks will be performed without a seek on the held `streambuf`, but there is no simple way for the client to predict when this will be the case&period;

== Return Value

the resulting stream position on success, or a negative position if the seek fails

== Parameters

[cols="1,4"]
|===
| Name| Description
| *offset*
| signed byte offset relative to `whence`
| *whence*
| base position for the seek (`beg`, `cur`, or `end`)
| *mode*
| open mode propagated to a seek on the held streambuf
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
