|
Boost Users : |
From: eg (egoots_at_[hidden])
Date: 2008-02-21 17:22:46
Mengda Wu wrote:
> Hi,
>
> I am trying to save gzip files and close them in my program without
> quitting it. And I would like
> to read these files using another program at the same time. The problem
> is I cannot access the gzip
> files unless I quit my program. Do you know whether I can properly save
> and close the gzip files with
> boost iostreams?
>
The following works for me when I call it in a function using boost
1.33.1 (in Windows XP):
using namespace std;
namespace io = boost::iostreams;
std::ifstream ifs(infile, std::ios_base::in | std::ios::binary);
io::filtering_ostream out;
out.push(io::gzip_compressor());
out.push( io::file_sink(outfile, ios_base::out | ios_base::binary));
out << ifs.rdbuf();
ifs.close();
out.flush();
out.reset();
// After the reset, the output file is closed.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net