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 |
|
---|
7 | using namespace std;
|
---|
8 | using namespace boost::iostreams;
|
---|
9 |
|
---|
10 |
|
---|
11 | int
|
---|
12 | main(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 | }
|
---|