/StormLib/stormlib/zlib/contrib/iostream2/zstream_test.cpp

http://ghostcb.googlecode.com/ · C++ · 25 lines · 21 code · 4 blank · 0 comment · 0 complexity · d32476bde4e6d5f889092fdff6f8cdb0 MD5 · raw file

  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. }