Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / z / contrib / iostream3 / test.cc
blob94235334f25cd5c5e2464d66f4c8ecf8ce161400
1 /*
2 * Test program for gzifstream and gzofstream
4 * by Ludwig Schwardt <schwardt@sun.ac.za>
5 * original version by Kevin Ruland <kevin@rodin.wustl.edu>
6 */
8 #include "zfstream.h"
9 #include <iostream> // for cout
11 int main() {
13 gzofstream outf;
14 gzifstream inf;
15 char buf[80];
17 outf.open("test1.txt.gz");
18 outf << "The quick brown fox sidestepped the lazy canine\n"
19 << 1.3 << "\nPlan " << 9 << std::endl;
20 outf.close();
21 std::cout << "Wrote the following message to 'test1.txt.gz' (check with zcat or zless):\n"
22 << "The quick brown fox sidestepped the lazy canine\n"
23 << 1.3 << "\nPlan " << 9 << std::endl;
25 std::cout << "\nReading 'test1.txt.gz' (buffered) produces:\n";
26 inf.open("test1.txt.gz");
27 while (inf.getline(buf,80,'\n')) {
28 std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n";
30 inf.close();
32 outf.rdbuf()->pubsetbuf(0,0);
33 outf.open("test2.txt.gz");
34 outf << setcompression(Z_NO_COMPRESSION)
35 << "The quick brown fox sidestepped the lazy canine\n"
36 << 1.3 << "\nPlan " << 9 << std::endl;
37 outf.close();
38 std::cout << "\nWrote the same message to 'test2.txt.gz' in uncompressed form";
40 std::cout << "\nReading 'test2.txt.gz' (unbuffered) produces:\n";
41 inf.rdbuf()->pubsetbuf(0,0);
42 inf.open("test2.txt.gz");
43 while (inf.getline(buf,80,'\n')) {
44 std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n";
46 inf.close();
48 return 0;