---
name: "zzip_seek"
section: "3"
platform: "linux"
package: "libzzip-dev"
version: "0.13.78+dfsg.1-0.1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/zzip_seek"
---

# zzip\_seek(3)

seek.

## NAME

zzip\_seek, zzip\_seek32 -  seek.

## SYNOPSIS

```
#include <zzip/lib.h>

zzip_off_t
zzip_seek(ZZIP_FILE* fp, zzip_off_t offset, int whence)
long
zzip_seek32(ZZIP_FILE* fp, long offset, int whence)
```

## DESCRIPTION

 The *zzip\_seek* function will perform a *[lseek(2)](/lseek/2.md)* operation on a real/zipped file

 It will try to seek to the offset specified by offset, relative to whence, which is one of SEEK\_SET, SEEK\_CUR or SEEK\_END.

 If the file-handle is wrapping a stat'able file then it will actually just perform a normal *[lseek(2)](/lseek/2.md)*-call. Otherwise the relative offset is calculated, negative offsets are transformed into positive ones by rewinding the file, and then data is read until the offset is reached. This can make the function terribly slow, but this is how gzio implements it, so I'm not sure there is a better way without using the internals of the algorithm.

 The *zzip\_seek32* function is provided for users who can not use any largefile-mode.

## AUTHOR

 Guido Draheim \<guidod@gmx.de\> Tomi Ollila \<Tomi.Ollila@iki.fi\>

## COPYRIGHT

 Copyright (c) Guido Draheim, use under copyleft (LGPL,MPL)
