C++ demo code for interaction with C
This example is mostly about making and using a RAII wrapper, not about calling C from C++ (which is trivial).

If you want to show how to call C-like interfaces, then use zlib directly, without wrapping it.

If you want to show the native C++ way to wrap a C interface, then the wrapper should be an iostream subclass, like gzstream.

pack should read blocks of finite size rather than reading the whole file at once. It's a compression utility, so it's likely to be used on files that won't fit in memory!

Some confusing names:


GzWrite instances aren't writes; they're streams. How about GzStream or (if it uses the iostreams interface) gzostream?
Don't call a function read; it's easy to confuse with Posix read. This is traditionally called slurp or read_file.
infn will probably be interpreted as "in-function", not "in-filename". How about infile?
laenge (Länge?): length


BLOCK_SZ and LEVEL are unused.