ZOPEN(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– NAME πŸ’–

okay so welcome to ZOPEN(3), straight outta the Library Functions Manual β€” this page is all about zopen, aka open a gzip compressed stream. bestie, it's literally the glow-up your compressed-file reading needed ✨

🧚 LIBRARY 🧚

Compression Library (libz, -lz) β€” that's the link-up, no cap.

🌸 SYNOPSIS 🌸

FILE *
zopen(const char *path, const char *mode);

FILE *
zdopen(int fd, const char *mode);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so zopen() opens a gzip file whose name is the string pointed to by path, and it returns a stream which can be used to access the uncompressed contents of the file. the zdopen() variant takes a gzip file referenced by the file descriptor fd, analogous to fdopen(3). they are wrappers around zlib(3) and the standard stream I/O APIs. iconic behavior, honestly.

the argument mode has the same meaning as it does in fopen(3). yes bestie, same mode energy.

zopen() and zdopen() will associate the read, write, seek and close functions of zlib(3) with the returned stream. periodt.

πŸ”₯ RETURN VALUES πŸ”₯

upon successful completion, zopen() and zdopen() return a FILE pointer. otherwise, NULL is returned and the global variable errno is set to indicate the error. so like, check that errno, bestie 😭

πŸ’€ ERRORS πŸ’€

in addition to the errors documented for fopen(3) and fdopen(3), the functions may also fail for:

  • [ENOMEM] β€” Insufficient memory is available.
that's the extra failure listed here, and it's giving β€œnot enough memory, bestie” energy πŸ™ˆ

🌈 COMPATIBILITY 🌈

the implementation of the zopen() function first appeared in NetBSD 1.6 and FreeBSD 4.5. zdopen() first appeared in FreeBSD 13.0. these functions may not be portable to systems other than FreeBSD. so if you're not on FreeBSD, do a vibe check before relying on them πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

fdopen(3), fopen(3), funopen(3), zlib(3)


this page is from Debian, dated December 6, 2018, and it's ZOPEN(3) β€” mwah, take care bestie πŸ’–

πŸ“¦ where this page comes from