views:

70

answers:

3

Is there a library in boost that can be used to unzip a zip file?

A: 

Why does it have to be boost? Can you not use zlib?

Dirk Eddelbuettel
No I can use zlib. I just wondered if there was anything in boost, it's a pretty big library that I am not yet familiar with.Additionally, I thought that I read that zlib doesn't actually work with zip files but I'm probably way out in left field somewhere on that one.
leeand00
+2  A: 

I don't think boost can do it.

I'd suggest zlib, but you might find it hard to use. If you need a very simple (yet powerful) C++ wrapper (handling zip files directly unlike zlib), then ZIP Archive will do the trick ;) (the code needs a few adjustments but works well, I've ported it to Visual C++ 2008 and removed the ATL dependency, it's pretty straightforward).

Samuel_xL
@TheSamFrom1984 Can this be used with Visual C++ 8.0/Visual C++ 2005?
leeand00
Yes, I actually use it with VC++2008, but I had to edit the source code (it's not hard at all). maybe i should upload that somewhere...
Samuel_xL
+1  A: 

boost::iostreams has a gzip filter that you can use. As a point of note, it only works on individually compressed files, not archives. In other words, it does not understand it if the archive has an internal directory structure (multiple files) instead of just compressing a single file. If you need the full archive functionality, then zlib is your best bet.

rcollyer
Yeah I do sorta need that functionality, I'm afraid, but thanks for the answer! :)
leeand00