ZIP_SOURCE_SEEK(3)
β¨ ZIP_SOURCE_SEEK β¨ (that's the zip_source_seek page from the Library Functions Manual, bestie π)
okay so real talk β this is a page from the Library Functions Manual and it's all about zip_source_seek, a lil function from libzip that lets you slide the read cursor around inside a zip source. it's giving "scrub to wherever you want in the file" energy. let's go π¦
π« NAME π«
zip_source_seek β set read offset in zip source
π LIBRARY π
libzip (-lzip)
(yeah girl, you gotta link against it, no cap π«Ά)
πΈ SYNOPSIS πΈ
#include <zip.h>
int
zip_source_seek(zip_source_t *source, zip_int64_t offset, int whence);
look at that signature. three args, one int back. iconic. π
π DESCRIPTION π
zip_source_seek() sets the current read offset for source. that's it, that's the whole job. it's the "where am i reading from now" setter.
and just like in fseek(3) (yes bestie, the classic), where you land depends on the whence argument β the offset gets counted relative from:
SEEK_SETβ start of file πSEEK_CURβ current read offset in file πSEEK_ENDβ end of file π
so like, SEEK_SET is "from the very beginning, main character origin story", SEEK_CUR is "from wherever i'm standing right now", and SEEK_END is "from the back, counting backwards". pick your vibe, the offset does the rest. β¨
π₯ RETURN VALUES π₯
upon successful completion, 0 is returned. slay.
otherwise, -1 comes back and the error information in source is set to indicate the error. so if you get a -1, check source for the tea β it'll tell you what went wrong. π
π«Ά SEE ALSO π«Ά
(go read zip_source_is_seekable(3) first if you're not sure your source even can seek, iykyk π)
π HISTORY π
zip_source_seek() was added in libzip 1.0. so it's been here since the beginning, a true OG. π
π AUTHORS π
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at>
absolute legends, we stan. π
and that's the whole page, bestie!! this one came from the Debian build, dated March 10, 2023, page ZIP_SOURCE_SEEK(3) β so if you're citing it or whatever, that's the version you're holding. now go forth and seek responsibly π§πβ¨
π¦ where this page comes from
- arch rolling: libzip 1.11.4-1 Β· BSD
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- nixpkgs unstable: libzip 1.11.4
- ubuntu resolute: libzip-dev 1.11.4-2 Β· BSD-3-Clause
- ubuntu stonking: libzip-dev 1.11.4-2build1 Β· BSD-3-Clause
- Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms