[#BloombergLP-bdls-FdStreamBuf_FileHandler-seek]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FdStreamBuf_FileHandler.adoc[FdStreamBuf&lowbar;FileHandler]::seek
:relfileprefix: ../../../
:mrdocs:

Set the file position associated with this object according to the specified `offset` and `dir` behavior&period;

== Synopsis

Declared in `&lt;bdls&lowbar;fdstreambuf&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::streampos
seek(
    std::streamoff offset,
    xref:BloombergLP/bdls/FilesystemUtil/Whence.adoc[FilesystemUtil::Whence] dir);
----

== Description

&ast; If &apos;dir&apos; is &apos;FilesystemUtil&colon;&colon;e&lowbar;SEEK&lowbar;FROM&lowbar;BEGINNING&apos;, set the position to &apos;offset&apos; bytes from the beginning of the file&period; &ast; If &apos;dir&apos; is &apos;FilesystemUtil&colon;&colon;e&lowbar;SEEK&lowbar;FROM&lowbar;CURRENT&apos;, advance the position by &apos;offset&apos; bytes &ast; If &apos;dir&apos; is &apos;FilesystemUtil&colon;&colon;e&lowbar;SEEK&lowbar;FROM&lowbar;END&apos;, set the position to &apos;offset&apos; bytes beyond the end of the file&period;

Return the new location of the file position, in bytes from the beginning of the file on success&semi; and `FilesystemUtil&colon;&colon;k&lowbar;INVALID&lowbar;FD` otherwise&period; The effect on the file position is undefined unless the file descriptor represents a device capable of seeking&period; Note that `seek` does not change the size of the file if the position advances beyond the end of the file&semi; instead, the next write at the pointer will increase the file size&period; Also note that on Windows in text mode, `offset` will be the number of bytes on disk passed over, including `r`s in &grave;&bsol;r
&grave; sequences&period;


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