GZFOPEN(3) BSD Programmer's Manual GZFOPEN(3)
gzfopen, gzfdopen - deflated stream open functions
#include <zlib.h> FILE * gzfopen(const char *path, const char *mode); FILE * gzfdopen(int filedes, const char *mode);
The gzfopen() function opens the file whose name is the string pointed to by path and associates a zlib stream with it. The gzfdopen() function associates a zlib stream with the existing file descriptor filedes. The mode of the stream must be compatible with the mode of the file descriptor. The stream is positioned at the file offset of the file descriptor, which must point to the first byte of the deflate magic in read mode. If gzfdopen() fails, the file descriptor filedes is not affected in any way. If gzfdopen() succeeds, any subsequential fclose() will also close and invalidate filedes. The argument mode points to a string beginning with one of the following characters (additional characters may follow): "r" Open file for reading. "w" Truncate file to zero length or create text file for writing. "a" Open for writing. The file is created if it does not exist. The characters which can follow are the same as for the gzopen() func- tion: "b" Binary mode (meaningless under UNIX). "f" Set the zlib stream strategy to filtered. "h" Set the zlib stream strategy to huffman-only. "R" Set the zlib stream to use RLE compression instead of deflate. "0..9" Set the compression level of the zlib stream used for writing.
Upon successful completion, gzfopen() and gzfdopen() return a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.
For both the gzfopen() and gzfdopen() functions, as well as stream opera- tions (read, write, seek, close), the code tries to meaningful map the zlib error codes to errno values. An unknown error is mapped to ENOCOFFEE. gzfopen() and gzfdopen() can return any error code which the underlying funopen() function returns, and fail for additional reasons.
close(2), funopen(3), gzclose(3), gzdopen(3), gzopen(3), gzread(3), gzseek(3), gzwrite(3), lseek(2), open(2), read(2), write(2) The description of deflateInit2() inside compress(3).
gzfopen and gzfdopen first appeared in MirOS #9.
The code and manual page have been written by Thorsten Glaser <email@example.com>.
Attempt to lseek() on the stream is subject to the same limitations as gzseek() is, and discouraged. MirOS BSD #10-current January 24, 2006 1
Generated on 2017-04-03 16:26:17 by $MirOS: src/scripts/roff2htm,v 1.88 2017/01/29 00:51:06 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2017 The MirOS Project, Germany.
This product includes material provided by mirabilos.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.