00001 00002 #include "zfstream.h" 00003 00004 int main() { 00005 00006 // Construct a stream object with this filebuffer. Anything sent 00007 // to this stream will go to standard out. 00008 gzofstream os( 1, ios::out ); 00009 00010 // This text is getting compressed and sent to stdout. 00011 // To prove this, run 'test | zcat'. 00012 os << "Hello, Mommy" << endl; 00013 00014 os << setcompressionlevel( Z_NO_COMPRESSION ); 00015 os << "hello, hello, hi, ho!" << endl; 00016 00017 setcompressionlevel( os, Z_DEFAULT_COMPRESSION ) 00018 << "I'm compressing again" << endl; 00019 00020 os.close(); 00021 00022 return 0; 00023 00024 }
1.4.6