Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

gzip - 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)){
  std::cout << line << std::endl;
}

But I wasn't able to actually link it (although I have a /usr/lib/libz.a). A simple

g++ test-gzstream.cpp -lz

didn't do it (undefined reference to gz::gzstreambase::~gzstreambase()).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Consider using the Boost zip filters. According to them, it supports bzip, gzip and zlib format.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...