diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:17:33 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:17:33 -0700 |
| commit | 7850e4e406dce1f7a819297eeb151d1ca18e7cd9 (patch) | |
| tree | d4befddacae46b06c4924193904de533099610b4 /contrib/iostream/test.cpp | |
| parent | ebd3c2c0e734fc99a1360014ea52ed04fe6aade4 (diff) | |
| download | zlib-7850e4e406dce1f7a819297eeb151d1ca18e7cd9.tar.gz zlib-7850e4e406dce1f7a819297eeb151d1ca18e7cd9.tar.bz2 zlib-7850e4e406dce1f7a819297eeb151d1ca18e7cd9.zip | |
zlib 1.0.7v1.0.7
Diffstat (limited to '')
| -rw-r--r-- | contrib/iostream/test.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/contrib/iostream/test.cpp b/contrib/iostream/test.cpp new file mode 100644 index 0000000..7d265b3 --- /dev/null +++ b/contrib/iostream/test.cpp | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | |||
| 2 | #include "zfstream.h" | ||
| 3 | |||
| 4 | int main() { | ||
| 5 | |||
| 6 | // Construct a stream object with this filebuffer. Anything sent | ||
| 7 | // to this stream will go to standard out. | ||
| 8 | gzofstream os( 1, ios::out ); | ||
| 9 | |||
| 10 | // This text is getting compressed and sent to stdout. | ||
| 11 | // To prove this, run 'test | zcat'. | ||
| 12 | os << "Hello, Mommy" << endl; | ||
| 13 | |||
| 14 | os << setcompressionlevel( Z_NO_COMPRESSION ); | ||
| 15 | os << "hello, hello, hi, ho!" << endl; | ||
| 16 | |||
| 17 | setcompressionlevel( os, Z_DEFAULT_COMPRESSION ) | ||
| 18 | << "I'm compressing again" << endl; | ||
| 19 | |||
| 20 | os.close(); | ||
| 21 | |||
| 22 | return 0; | ||
| 23 | |||
| 24 | } | ||
