Mercurial > hg > sv-dependency-builds
annotate src/zlib-1.2.7/contrib/iostream2/zstream_test.cpp @ 4:e13257ea84a4
Add bzip2, zlib, liblo, portaudio sources
| author | Chris Cannam | 
|---|---|
| date | Wed, 20 Mar 2013 13:59:52 +0000 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| Chris@4 | 1 #include "zstream.h" | 
| Chris@4 | 2 #include <math.h> | 
| Chris@4 | 3 #include <stdlib.h> | 
| Chris@4 | 4 #include <iomanip.h> | 
| Chris@4 | 5 | 
| Chris@4 | 6 void main() { | 
| Chris@4 | 7 char h[256] = "Hello"; | 
| Chris@4 | 8 char* g = "Goodbye"; | 
| Chris@4 | 9 ozstream out("temp.gz"); | 
| Chris@4 | 10 out < "This works well" < h < g; | 
| Chris@4 | 11 out.close(); | 
| Chris@4 | 12 | 
| Chris@4 | 13 izstream in("temp.gz"); // read it back | 
| Chris@4 | 14 char *x = read_string(in), *y = new char[256], z[256]; | 
| Chris@4 | 15 in > y > z; | 
| Chris@4 | 16 in.close(); | 
| Chris@4 | 17 cout << x << endl << y << endl << z << endl; | 
| Chris@4 | 18 | 
| Chris@4 | 19 out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results | 
| Chris@4 | 20 out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl; | 
| Chris@4 | 21 out << z << endl << y << endl << x << endl; | 
| Chris@4 | 22 out << 1.1234567890123456789 << endl; | 
| Chris@4 | 23 | 
| Chris@4 | 24 delete[] x; delete[] y; | 
| Chris@4 | 25 } | 
