The gzseek() function shall set the file-position indicator for the compressed file stream file. The file-position indicator controls where the next read or write operation on the compressed file stream shall take place. The offset indicates a byte offset in the uncompressed data. The whence parameter may be one of:
the offset is relative to the start of the uncompressed data.
the offset is relative to the current positition in the uncompressed data.
Note: The value
SEEK_ENDneed not be supported.
If the file is open for writing, the new offset must be greater than or equal to the current offset. In this case, gzseek() shall compress a sequence of null bytes to fill the gap from the previous offset to the new offset.
On success, gzseek() shall return the resulting offset in the file expressed as a byte position in the uncompressed data stream. On error, gzseek() shall return -1, and may set the error value for file accordingly.
On error, gzseek() shall return -1. The following conditions shall always result in an error:
file does not represent an open compressed file stream.
file refers to a compressed file stream that is open for writing, and the newly computed offset is less than the current offset.
The newly computed offset is less than zero.
whence is not one of the supported values.
If file is open for reading, the implementation may still need to uncompress all of the data up to the new offset. As a result, gzseek() may be extremely slow in some circumstances.