I am using the boost filtering stream object to read gzipped files. Works great! I would like to display a progress bar for the amount of the file that has been processed. I need find the input uncompressed file size. Does the gzip decompressor have access to the original file size from the gzipped file? I couldn't find it on the boost gzip_decompressor reference page. Really the progress dialog is the goal, is there another way to figure out position in the compressed file?
// gets compressed file size, need uncompressed size
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 ();
// progress dlg with bytes_read / uncompressed size
}