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