ZIP_SOURCE_SEEK_WRITE(3)

πŸ“¦
version 1.11.4 Β· 4 versions
, in arch rolling, fedora 43, fedora 44, nixpkgs unstable, ubuntu resolute, ubuntu stonking

✨ ZIP_SOURCE_SEEK_WRITE(3) ✨

okay bestie, we're doing the zip_source_seek_write page from the library functions manual, and honestly? it's a little bop. it's in libzip, obvi, and it's the one that moves your write cursor around like it owns the place πŸ’…


πŸŽ€ NAME πŸŽ€

zip_source_seek_write β€” set write offset in zip source

like, it literally just repositions where the next write is gonna land. that's the whole job. main character behaviour fr.


πŸ¦‹ LIBRARY πŸ¦‹

libzip (-lzip)

link against it, bestie, that's the vibe.


✨ SYNOPSIS ✨

#include <zip.h>

int
zip_source_seek_write(zip_source_t *source, zip_int64_t offset,
    int whence);

look at that signature. source, offset, whence. three little guys, one big destiny 🫢


πŸ’– DESCRIPTION πŸ’–

so the function zip_source_seek_write() sets the current write offset for source. that's it, that's the tea πŸ“

and listen β€” it works just like fseek(3). so depending on what you pass as the whence argument, the offset gets counted relative from one of these iconic little spots:

  • SEEK_SET β€” start of file 🏁
  • SEEK_CUR β€” current write offset in file πŸ“
  • SEEK_END β€” end of file πŸ”š

pick your anchor point, pick your distance, go. no cap.


πŸ’€ RETURN VALUES πŸ’€

  • upon successful completion, 0 is returned πŸŽ‰ slay.
  • otherwise, -1 is returned and the error information in source is set to indicate the error 😭 so like, check your errors, babe, they're right there in source.
ngl, -1 is the "not me, not today" of return values. don't ignore it.

🌈 SEE ALSO 🌈

the whole little friend group, iykyk:


πŸ‘‘ HISTORY πŸ‘‘

zip_source_seek_write() was added in libzip 1.0. vintage. a classic. it's been serving since day one πŸ•°οΈβœ¨


🧚 AUTHORS 🧚

Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at>

the two icons who wrote this. give them their flowers πŸ’


and that's the page, bestie!! πŸ’– this was from the Debian build of the manual, dated December 18, 2017, and it's the ZIP_SOURCE_SEEK_WRITE(3) page β€” go forth and seek responsibly πŸ¦‹βœ¨

πŸ“¦ where this page comes from