Fossil SCM

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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button