Gzstream Library Home Page


Gzstream is a small C++ library, basically just a wrapper, that provides the functionality of the zlib C-library in a C++ iostream. It is freely available under the LGPL license.

Gzstream has been written by Deepak Bandyopadhyay and Lutz Kettner at the Computational Geometry Group at UNC Chapel Hill.

Supported Systems

Gzstream requires a standard compliant C++ compiler (we use the new header file conventions and the new iostream in the std:: name space) and, of course, zlib. We used zlib 1.1.3 so far, but see the zlib home page for why you should upgrade to zlib 1.1.4. So, in theory, the provided sources could run on many platforms. However, we used only the following few platforms.


Either compile gzstream.C by hand, place it in some library, and move gzstream.h into the include search path of your compiler. Or use the provided Makefile, adapt its variables, and follow the remarks in the Makefile. Two test programs are provided, test_gzip.C and test_gunzip.C. The Makefile contains a rule that performs a small test with these programs.


The library provides two classes, igzstream and ogzstream, that can be used analogously to ifstream and ofstream respectively.

The classes are by default in the global name space. This can be changed by setting the macro GZSTREAM_NAMESPACE to the desired name space, e.g., by setting the option -DGZSTREAM_NAMESPACE=gz in the Makefile. However, this needs to be consistent for both, the library compilation and the application that uses the library.

What's Missing

Download and Release Notes


Credits for finding bugs and improving this software go to: Vincent Ricard, Peter Milley, Peter J. Torelli, and Ares Lagae.


The Computational Geometry Group at UNC Chapel Hill, Jan. 08, 2003.