From 258e1b92ebbfdebefabc120969ab87c3d8b75c3d Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Sun, 15 Jun 2014 03:50:12 +0200
Subject: old c,cc examples
---
c,cc/compression_test.cc | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 c,cc/compression_test.cc
(limited to 'c,cc/compression_test.cc')
diff --git a/c,cc/compression_test.cc b/c,cc/compression_test.cc
new file mode 100644
index 0000000..21bfafc
--- /dev/null
+++ b/c,cc/compression_test.cc
@@ -0,0 +1,45 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace boost::iostreams;
+using namespace std;
+
+
+int main(void)
+{
+ //ofstream raw("out-raw");
+ filtering_ostream out_z;
+ out_z.push(gzip_compressor());
+ //out_gz.push(gzip_compressor());
+ out_z.push(file_sink("out-z", std::ios::binary));
+ //out_gz.push(file_sink("out-gz", std::ios::binary));
+ for (size_t i = 0; i < 10; i++) {
+ out_z << "line #" << i << endl;
+ //out_gz << "line #" << i << endl;
+ //out_bz << "line #" << i << endl;
+ //raw << "line #" << i << endl;
+ }
+ // flush(out);
+ close(out_z);
+ //close(out_gz);
+ //close(out_bz);
+ //raw.close();
+
+ for (size_t i = 0; i < 5; i++) {
+ ifstream file("out-z", ios_base::in | ios_base::binary);
+ filtering_istream in;
+ in.push(gzip_decompressor());
+ in.push(file);
+ string s;
+ while (getline(in, s)) {
+ cout << s << endl;
+ }
+ file.close();
+ }
+}
+
--
cgit v1.2.3