/build/buildd/nifticlib-1.1.0/znzlib/znzlib.c File Reference
Low level i/o interface to compressed and noncompressed files. Written by Mark Jenkinson, FMRIB.
More...
#include "znzlib.h"
|
Functions |
znzFile | znzopen (const char *path, const char *mode, int use_compression) |
znzFile | znzdopen (int fd, 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) |
long | znzseek (znzFile file, long offset, int whence) |
int | znzrewind (znzFile stream) |
long | znztell (znzFile file) |
int | znzputs (const char *str, znzFile file) |
char * | znzgets (char *str, int size, znzFile file) |
int | znzflush (znzFile file) |
int | znzeof (znzFile file) |
int | znzputc (int c, znzFile file) |
int | znzgetc (znzFile file) |
int | znzprintf (znzFile stream, const char *format,...) |
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