Using fopenz() and fgunzip() functions, it is possible to read gzipped files with standard fread() function from stdio.h. Write or seek is not supported. This extension requires ability to virtualize FILE* files. Only Linux (GNU libc) and BSD are therefore supported. Not tested under BSD. It doesn't depend on zlib.

#include <stdio.h>

FILE *fopenz(const char *name, const char *mode);
FILE *fgunzip(FILE *f);

The file should be fclose()'d before exit (due to risk of a race condition). It is possible that fgunzip() will cause unstability within stdio library (due to use FILE inside a callback).

Download: gzfile-0.4.tar.gz

Free Web Hosting