zpipe v1.00 is a minimal ZPAQ compatible streaming file compressor and decompresser. It reads from stdin to stdout, so it can be used as a pipe like in standard UNIX commands. It works in Windows by setting stdin and stdout in binary mode.

Code:
To compress:   zpipe c < input > output
To decompress: zpipe d < input > output
Compression is equivalent to

Code:
zpaq nicmid.cfg output input
(n=no filename, i=no comment, cmid.cfg=compress with default mid.cfg). Input is compressed to a single segment of a single block. At EOF, zpipe appends the SHA1 checksum.

Decompression works on archives produced by any ZPAQ compatible program, including self extracting archives. Any non-ZPAQ mixed in is skipped. If the archive contains more than one file, they are concatenated. Stored filenames are ignored. It gives an error if a stored checksum is present and incorrect.

The purpose of the program is to illustrate how to write minimal ZPAQ compatible compressors. It uses basically the code from unzpaq, but with the addition of ZPAQ::load(), ZPAQ::write(), class Encoder, and an array initialization from a compiled mid.cfg (compiled by "zpaq vtrmid.cfg") to support compression. The array is loaded and written at the start of compression and then compressed with the arithmetic encoder. All the modeling code is shared with the decompresser.

With g++ in Windows you can set stdin and stdout to binary mode like this:
Code:
#include <fcntl.h>
...
setmode(0, O_BINARY);  // stdin
setmode(1, O_BINARY);  // stdout
It doesn't work in Borland or Mars. Haven't tried other compilers.

http://mattmahoney.net/dc/#zpaq