Loading...
Searching...
No Matches
znzlib.c File Reference

Low level i/o interface to compressed and noncompressed files. Written by Mark Jenkinson, FMRIB. More...

`#include "znzlib.h"`
`#include "znzlib_version.h"`
Include dependency graph for znzlib.c:

## Macros

#define | ZNZ_MAX_BLOCK_SIZE (1<<30)

## Functions

znzFile | znzopen (const char *path, const char *mode, int use_compression)
int | Xznzclose (znzFile *file)
size_t | znzread (void *buf, size_t size, size_t nmemb, znzFile file)
size_t | znzwrite (const void *buf, size_t size, size_t nmemb, znzFile file)
znz_off_t | znzseek (znzFile file, znz_off_t offset, int whence)
int | znzrewind (znzFile stream)
znz_off_t | znztell (znzFile file)
int | znzputs (const char *str, znzFile file)

## Detailed Description

Low level i/o interface to compressed and noncompressed files. Written by Mark Jenkinson, FMRIB.

This library provides an interface to both compressed (gzip/zlib) and uncompressed (normal) file IO. The functions are written to have the same interface as the standard file IO functions.

To use this library instead of normal file IO, the following changes are required:

- replace all instances of FILE* with znzFile
- change the name of all function calls, replacing the initial character f with the znz (e.g. fseek becomes znzseek) one exception is rewind() -> znzrewind()
- add a third parameter to all calls to znzopen (previously fopen) that specifies whether to use compression (1) or not (0)
- use znz_isnull rather than any (pointer == NULL) comparisons in the code for znzfile types (normally done after a return from znzopen)

NB: seeks for writable files with compression are quite restricted