| 1 |
|
|---|
| 2 | #include <fstream>
|
|---|
| 3 | #include <boost/iostreams/copy.hpp>
|
|---|
| 4 | #include <boost/iostreams/filtering_stream.hpp>
|
|---|
| 5 | #include <boost/iostreams/filter/bzip2.hpp>
|
|---|
| 6 |
|
|---|
| 7 | int main(int argc, char **argv)
|
|---|
| 8 | {
|
|---|
| 9 | std::ifstream ifile("/tmp/input", std::ios_base::in | std::ios_base::binary);
|
|---|
| 10 | std::ofstream ofile("/tmp/output", std::ios_base::out | std::ios_base::binary);
|
|---|
| 11 |
|
|---|
| 12 | // This never outputs anything
|
|---|
| 13 | //boost::iostreams::filtering_stream<boost::iostreams::input> stream;
|
|---|
| 14 | //stream.push(boost::iostreams::bzip2_compressor());
|
|---|
| 15 | //stream.push(ifile);
|
|---|
| 16 | //boost::iostreams::copy(stream, ofile);
|
|---|
| 17 |
|
|---|
| 18 | boost::iostreams::filtering_stream<boost::iostreams::output> stream;
|
|---|
| 19 | stream.push(boost::iostreams::bzip2_compressor());
|
|---|
| 20 | stream.push(ofile);
|
|---|
| 21 | boost::iostreams::copy(ifile, stream);
|
|---|
| 22 |
|
|---|
| 23 | return 0;
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|