minix/common/dist/zlib/contrib/iostream2/zstream_test.cpp
Lionel Sambuc 44bedb31d8 Importing common/dist/zlib
Change-Id: I46de716a98ccc501ca32b2a9445d9964594ddc61
2013-01-14 11:36:27 +01:00

25 lines
711 B
C++

#include "zstream.h"
#include <math.h>
#include <stdlib.h>
#include <iomanip.h>
void main() {
char h[256] = "Hello";
char* g = "Goodbye";
ozstream out("temp.gz");
out < "This works well" < h < g;
out.close();
izstream in("temp.gz"); // read it back
char *x = read_string(in), *y = new char[256], z[256];
in > y > z;
in.close();
cout << x << endl << y << endl << z << endl;
out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results
out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl;
out << z << endl << y << endl << x << endl;
out << 1.1234567890123456789 << endl;
delete[] x; delete[] y;
}