[#BloombergLP-bdls-FdStreamBuf-seekoff]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FdStreamBuf.adoc[FdStreamBuf]::seekoff
:relfileprefix: ../../../
:mrdocs:

Set the file pointer associated with the file descriptor according to the specified `offset` and `whence`&colon;

== Synopsis

Declared in `&lt;bdls&lowbar;fdstreambuf&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 = bsl&colon;&colon;ios&lowbar;base&colon;&colon;in &verbar; bsl&colon;&colon;ios&lowbar;base&colon;&colon;out) override;
----

== Description

&ast; If &apos;whence&apos; is &apos;bsl&colon;&colon;ios&lowbar;base&colon;&colon;beg&apos;, set the pointer to &apos;offset&apos; bytes from the beginning of the file&period; &ast; If &apos;whence&apos; is &apos;bsl&colon;&colon;ios&lowbar;base&colon;&colon;cur&apos;, advance the pointer by &apos;offset&apos; bytes &ast; If &apos;whence&apos; is &apos;bsl&colon;&colon;ios&lowbar;base&colon;&colon;end&apos;, set the pointer to &apos;offset&apos; bytes beyond the end of the file&period;

Optionally specify `mode`, which is ignored&period; Return the new location of the file position, in bytes from the beginning of the file, on success, and &hyphen;1 otherwise&period; The behavior is undefined unless the file descriptor is on a device capable of seeking&period; Note that seeking does not change the size of the file if the pointer advances beyond the end of the file&semi; instead, the next write at the pointer will increase the file size&period; Also note that seeks are always in terms of bytes on the device, meaning that in Windows text mode, seeking past a &grave; &grave; perceived by the caller will count as 2 bytes since it has to seek over a &grave;&bsol;r &grave; sequence on the device&period;

== Return Value

the new file position in bytes from the beginning on success, and &hyphen;1 otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *offset*
| byte offset relative to `whence`
| *whence*
| origin of the seek (`beg`, `cur`, or `end`)
| *mode*
| ignored open&hyphen;mode flags
|===


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