kusano fc6ab3
kusano fc6ab3
#include "zfstream.h"
kusano fc6ab3
kusano fc6ab3
int main() {
kusano fc6ab3
kusano fc6ab3
  // Construct a stream object with this filebuffer.  Anything sent
kusano fc6ab3
  // to this stream will go to standard out.
kusano fc6ab3
  gzofstream os( 1, ios::out );
kusano fc6ab3
kusano fc6ab3
  // This text is getting compressed and sent to stdout.
kusano fc6ab3
  // To prove this, run 'test | zcat'.
kusano fc6ab3
  os << "Hello, Mommy" << endl;
kusano fc6ab3
kusano fc6ab3
  os << setcompressionlevel( Z_NO_COMPRESSION );
kusano fc6ab3
  os << "hello, hello, hi, ho!" << endl;
kusano fc6ab3
kusano fc6ab3
  setcompressionlevel( os, Z_DEFAULT_COMPRESSION )
kusano fc6ab3
    << "I'm compressing again" << endl;
kusano fc6ab3
kusano fc6ab3
  os.close();
kusano fc6ab3
kusano fc6ab3
  return 0;
kusano fc6ab3
kusano fc6ab3
}