Ticket #3853: test_bzip2_decompressor.cc

File test_bzip2_decompressor.cc, 519 bytes (added by Darko Veberic <darko.veberic@…>, 13 years ago)

decompressor using boost iostream filter

Line 
1#include <iostream>
2#include <fstream>
3#include <boost/iostreams/filtering_stream.hpp>
4#include <boost/iostreams/filter/bzip2.hpp>
5#include <boost/iostreams/copy.hpp>
6
7using namespace std;
8using namespace boost::iostreams;
9
10
11int
12main(int argc, char* argv[])
13{
14 if (argc != 2) {
15 cerr << "filename missing!" << endl;
16 return 1;
17 }
18
19 ifstream file;
20 file.open(argv[1], ios_base::in | ios_base::binary);
21 filtering_istream in;
22 in.push(bzip2_decompressor());
23 in.push(file);
24
25 copy(in, cout);
26
27 return 0;
28}