annotate src/zlib-1.2.8/contrib/iostream/test.cpp @ 128:5b4145a0d408

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