[#BloombergLP-bdls-FilesystemUtil-seek]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FilesystemUtil.adoc[FilesystemUtil]::seek
:relfileprefix: ../../../
:mrdocs:

Set the file pointer associated with `descriptor` according to `whence`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:BloombergLP/bdls/FilesystemUtil/Offset.adoc[Offset]
seek(
    xref:BloombergLP/bdls/FilesystemUtil/FileDescriptor.adoc[FileDescriptor] descriptor,
    xref:BloombergLP/bdls/FilesystemUtil/Offset.adoc[Offset] offset,
    int whence);
----

== Description

Set the file pointer associated with the specified `descriptor` (used by calls to the `read` and `write` system calls) according to the specified `whence` behavior&colon; &grave; &ast; If &apos;whence&apos; is e&lowbar;SEEK&lowbar;FROM&lowbar;BEGINNING, set the pointer to &apos;offset&apos; bytes from the beginning of the file&period; &ast; If &apos;whence&apos; is e&lowbar;SEEK&lowbar;FROM&lowbar;CURRENT, advance the pointer by &apos;offset&apos; bytes &ast; If &apos;whence&apos; is e&lowbar;SEEK&lowbar;FROM&lowbar;END, set the pointer to &apos;offset&apos; bytes beyond the end of the file&period; &grave; Return the new location of the file pointer, in bytes from the beginning of the file, on success&semi; and &hyphen;1 otherwise&period; The effect on the file pointer is undefined unless the file is on a device capable of seeking&period; Note that `seek` 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;

== Return Value

the new file&hyphen;pointer location on success, and &hyphen;1 otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *descriptor*
| file descriptor whose file pointer is set
| *offset*
| byte offset applied according to `whence`
| *whence*
| starting point for the seek operation
|===


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