summaryrefslogtreecommitdiff
path: root/contrib/iostream2/zstream_test.cpp
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:17:33 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:17:33 -0700
commit7850e4e406dce1f7a819297eeb151d1ca18e7cd9 (patch)
treed4befddacae46b06c4924193904de533099610b4 /contrib/iostream2/zstream_test.cpp
parentebd3c2c0e734fc99a1360014ea52ed04fe6aade4 (diff)
downloadzlib-1.0.7.tar.gz
zlib-1.0.7.tar.bz2
zlib-1.0.7.zip
zlib 1.0.7v1.0.7
Diffstat (limited to 'contrib/iostream2/zstream_test.cpp')
-rw-r--r--contrib/iostream2/zstream_test.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/iostream2/zstream_test.cpp b/contrib/iostream2/zstream_test.cpp
new file mode 100644
index 0000000..5bbd56c
--- /dev/null
+++ b/contrib/iostream2/zstream_test.cpp
@@ -0,0 +1,25 @@
1#include "zstream.h"
2#include <math.h>
3#include <stdlib.h>
4#include <iomanip.h>
5
6void main() {
7 char h[256] = "Hello";
8 char* g = "Goodbye";
9 ozstream out("temp.gz");
10 out < "This works well" < h < g;
11 out.close();
12
13 izstream in("temp.gz"); // read it back
14 char *x = read_string(in), *y = new char[256], z[256];
15 in > y > z;
16 in.close();
17 cout << x << endl << y << endl << z << endl;
18
19 out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results
20 out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl;
21 out << z << endl << y << endl << x << endl;
22 out << 1.1234567890123456789 << endl;
23
24 delete[] x; delete[] y;
25}