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