I am using a filter filter flow object to read gzipped files. Works great! I would like to display a progress bar for the volume of the file that has been processed. I need to find the size of an uncompressed input file. Does the gzip unpacker have the original file size from the gzip file? I could not find it on the enlarge gzip_decompressor reference page . Actually the progress dialog is the goal, is there any other way to determine the position in the compressed file?
boost::uintmax_t fs = boost::filesystem::file_size (
boost::filesystem::path (fname)
);
std::ifstream file (fname, std::ios_base::in | std::ios_base::binary);
boost::iostreams::filtering_istream in;
in.push (boost::iostreams::gzip_decompressor());
in.push (file);
std::string line;
size_t bytes_read = 0;
while (in)
{
std::getline (in, line);
bytes_read += line.size ();
}
source
share