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