annotate src/zlib-1.2.8/contrib/iostream2/zstream_test.cpp @ 155:54abead6ecce

Opus for Windows (MSVC)
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 25 Jan 2019 12:15:58 +0000
parents 5b4145a0d408
children
rev   line source
cannam@128 1 #include "zstream.h"
cannam@128 2 #include <math.h>
cannam@128 3 #include <stdlib.h>
cannam@128 4 #include <iomanip.h>
cannam@128 5
cannam@128 6 void main() {
cannam@128 7 char h[256] = "Hello";
cannam@128 8 char* g = "Goodbye";
cannam@128 9 ozstream out("temp.gz");
cannam@128 10 out < "This works well" < h < g;
cannam@128 11 out.close();
cannam@128 12
cannam@128 13 izstream in("temp.gz"); // read it back
cannam@128 14 char *x = read_string(in), *y = new char[256], z[256];
cannam@128 15 in > y > z;
cannam@128 16 in.close();
cannam@128 17 cout << x << endl << y << endl << z << endl;
cannam@128 18
cannam@128 19 out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results
cannam@128 20 out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl;
cannam@128 21 out << z << endl << y << endl << x << endl;
cannam@128 22 out << 1.1234567890123456789 << endl;
cannam@128 23
cannam@128 24 delete[] x; delete[] y;
cannam@128 25 }