Fossil SCM

fossil-scm / compat / zlib / contrib / iostream2 / zstream_test.cpp
Source Blame History 25 lines
7ef7284… drh 1 #include "zstream.h"
7ef7284… drh 2 #include <math.h>
7ef7284… drh 3 #include <stdlib.h>
7ef7284… drh 4 #include <iomanip.h>
7ef7284… drh 5
7ef7284… drh 6 void main() {
7ef7284… drh 7 char h[256] = "Hello";
7ef7284… drh 8 char* g = "Goodbye";
7ef7284… drh 9 ozstream out("temp.gz");
7ef7284… drh 10 out < "This works well" < h < g;
7ef7284… drh 11 out.close();
7ef7284… drh 12
7ef7284… drh 13 izstream in("temp.gz"); // read it back
7ef7284… drh 14 char *x = read_string(in), *y = new char[256], z[256];
7ef7284… drh 15 in > y > z;
7ef7284… drh 16 in.close();
7ef7284… drh 17 cout << x << endl << y << endl << z << endl;
7ef7284… drh 18
7ef7284… drh 19 out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results
7ef7284… drh 20 out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl;
7ef7284… drh 21 out << z << endl << y << endl << x << endl;
7ef7284… drh 22 out << 1.1234567890123456789 << endl;
7ef7284… drh 23
7ef7284… drh 24 delete[] x; delete[] y;
7ef7284… drh 25 }

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button