Skip to main content

All Questions

Tagged with
36 votes
4 answers
35k views

How to check if a file is gzip compressed?

I have a C / C++ program which needs to read in a file that may or may not be gzip compressed. I know we can use gzread() from zlib to read in both compressed and uncompressed files - however, I want ...
Deepak Prakash's user avatar
7 votes
1 answer
7k views

Uncompressed file size using zlib's gzip file access function

Using linux command line tool gzip I can tell the uncompressed size of a compress file using gzip -l. I couldn't find any function like that on zlib manual section "gzip File Access Functions". At ...
André Puel's user avatar
  • 9,069
27 votes
7 answers
30k views

How to read a .gz file line-by-line in C++?

I have 3 terabyte .gz file and want to read its uncompressed content line-by-line in a C++ program. As the file is quite huge, I want to avoid loading it completely in memory. Can anyone post a ...
Shihab's user avatar
  • 271
16 votes
5 answers
54k views

How do I read / write gzipped files in C++?

How do I read / write gzipped files in C++? The iostream wrapper classes here look good, and here is a simple usage example: gz::igzstream in(filename); std::string line; while(std::getline(in, line)...
Frank's user avatar
  • 65.8k
15 votes
4 answers
7k views

How to concat two or more gzip files/streams

I want to concat two or more gzip streams without recompressing them. I mean I have A compressed to A.gz and B to B.gz, I want to compress them to single gzip (A+B).gz without compressing once again,...
Artyom's user avatar
  • 31.1k
17 votes
1 answer
21k views

How can I read line-by-line using Boost IOStreams' interface for Gzip files?

I managed to integrate the boost Iostream APIs for reading zipped files. I followed the documentation in boost page and have the following code so-far: std::stringstream outStr; ifstream file("...
cppcoder's user avatar
  • 1,204
13 votes
3 answers
20k views

Is there any cross-platform gzip processor library for C or C++? [closed]

I want some library (API) to open, seek, read, write ... (in one word to process) gzip files. Is there any open-source cross-platform ones for C or C++?
Mihran Hovsepyan's user avatar
10 votes
1 answer
9k views

boost gzip decompress byte array

I implemented the gzip/zlib decompression of files as shown in their examples on the boost site. void CompressionUtils::Inflate(std::ifstream& inputFile, std::...
Rob Goodwin's user avatar
  • 2,748
11 votes
4 answers
11k views

Compress string with GZip using qCompress?

I have a string of hex data (0a000a0165787a... etc) that I write to a file like this: void Output(QString FilePath, QString Output) { QFile file(FilePath); if(!file.open(QIODevice::WriteOnly))...
mrg95's user avatar
  • 2,410
5 votes
0 answers
2k views

boost::iostreams, gzip files and tellg

I have been using boost::iostreams for reading an uncompressed text file. In my application, I need multiple file handles (stored in a map) to efficiently buffer data for different parameters stored ...
user2661268's user avatar
3 votes
1 answer
9k views

Uncompress() of 'zlib' returns Z_DATA_ERROR

I made a simple function which takes a gzipped file, and extracts somewhere. For testing purposes i'm using a text file which had been gzipped through a generic utility gzip. But for some reason the ...
Hi-Angel's user avatar
  • 5,479
2 votes
1 answer
340 views

How to get gzip_params from boost's gzip_decompressor()

I am using the boost gzip_decompressor() from the following link: How can I read line-by-line using Boost IOStreams' interface for Gzip files? Reading the gzip file works fine, but how do I read ...
vg8open's user avatar
  • 57
1 vote
1 answer
706 views

Iterating over mmaped gzip file with boost

I am trying to learn boost and some template programming in C++ but I am really having such an hard time to implement a simple class for iterating over Gzip files using mapped_file_source. I ...
nopper's user avatar
  • 825
1 vote
1 answer
5k views

zlib inflate returning a buffer error

I'm trying to decompress a zip file using zlib (without using any extension or 3rd party). Initially, the src_len is 48756255, and the dest_len is 49209890. The first pass in the while loop is fine: ...
David Menard's user avatar
  • 2,311
0 votes
0 answers
336 views

Writing gzipped output file without extra disk space with pipe

I have the following implemented functionality for reading gzipped files without disk usage. #include <fstream> #include <stdlib.h> // for mkstemp() and std::system() #include <memory&...
N.A.'s user avatar
  • 1,489