Home | History | Annotate | Line # | Download | only in iostream
test.cpp revision 1.1
      1  1.1  christos 
      2  1.1  christos #include "zfstream.h"
      3  1.1  christos 
      4  1.1  christos int main() {
      5  1.1  christos 
      6  1.1  christos   // Construct a stream object with this filebuffer.  Anything sent
      7  1.1  christos   // to this stream will go to standard out.
      8  1.1  christos   gzofstream os( 1, ios::out );
      9  1.1  christos 
     10  1.1  christos   // This text is getting compressed and sent to stdout.
     11  1.1  christos   // To prove this, run 'test | zcat'.
     12  1.1  christos   os << "Hello, Mommy" << endl;
     13  1.1  christos 
     14  1.1  christos   os << setcompressionlevel( Z_NO_COMPRESSION );
     15  1.1  christos   os << "hello, hello, hi, ho!" << endl;
     16  1.1  christos 
     17  1.1  christos   setcompressionlevel( os, Z_DEFAULT_COMPRESSION )
     18  1.1  christos     << "I'm compressing again" << endl;
     19  1.1  christos 
     20  1.1  christos   os.close();
     21  1.1  christos 
     22  1.1  christos   return 0;
     23  1.1  christos 
     24  1.1  christos }
     25