annotate src/zlib-1.2.8/contrib/iostream/test.cpp @ 43:5ea0608b923f

Current zlib source
author Chris Cannam
date Tue, 18 Oct 2016 14:33:52 +0100
parents
children
rev   line source
Chris@43 1
Chris@43 2 #include "zfstream.h"
Chris@43 3
Chris@43 4 int main() {
Chris@43 5
Chris@43 6 // Construct a stream object with this filebuffer. Anything sent
Chris@43 7 // to this stream will go to standard out.
Chris@43 8 gzofstream os( 1, ios::out );
Chris@43 9
Chris@43 10 // This text is getting compressed and sent to stdout.
Chris@43 11 // To prove this, run 'test | zcat'.
Chris@43 12 os << "Hello, Mommy" << endl;
Chris@43 13
Chris@43 14 os << setcompressionlevel( Z_NO_COMPRESSION );
Chris@43 15 os << "hello, hello, hi, ho!" << endl;
Chris@43 16
Chris@43 17 setcompressionlevel( os, Z_DEFAULT_COMPRESSION )
Chris@43 18 << "I'm compressing again" << endl;
Chris@43 19
Chris@43 20 os.close();
Chris@43 21
Chris@43 22 return 0;
Chris@43 23
Chris@43 24 }