Set the file position associated with this object according to the specified offset and dir behavior.

Synopsis

Declared in <bdls_fdstreambuf.h>

std::streampos
seek(
    std::streamoff offset,
    FilesystemUtil::Whence dir);

Description

* If 'dir' is 'FilesystemUtil::e_SEEK_FROM_BEGINNING', set the position to 'offset' bytes from the beginning of the file. * If 'dir' is 'FilesystemUtil::e_SEEK_FROM_CURRENT', advance the position by 'offset' bytes * If 'dir' is 'FilesystemUtil::e_SEEK_FROM_END', set the position to 'offset' bytes beyond the end of the file.

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

Created with MrDocs