[#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`. == Synopsis Declared in `<bdls_filesystemutil.h>` [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: ` * If 'whence' is e_SEEK_FROM_BEGINNING, set the pointer to 'offset' bytes from the beginning of the file. * If 'whence' is e_SEEK_FROM_CURRENT, advance the pointer by 'offset' bytes * If 'whence' is e_SEEK_FROM_END, set the pointer to 'offset' bytes beyond the end of the file. ` Return the new location of the file pointer, in bytes from the beginning of the file, on success; and ‐1 otherwise. The effect on the file pointer is undefined unless the file is on a device capable of seeking. Note that `seek` does not change the size of the file if the pointer advances beyond the end of the file; instead, the next write at the pointer will increase the file size. == Return Value the new file‐pointer location on success, and ‐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]#