zstream_test.cpp 711 B

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