tags:

views:

114

answers:

3

I want to manipulate .zip and .rar files from C++. What libraries should I use?

+4  A: 

The zlib library comes with a sample showing how you can use it with .zip files (I think it's called "minizip" or something, though I haven't had much experience with it personally).

RAR is a bit difference, since it's basically proprietary. I don't know if there's any libraries that can do it.

Dean Harding
Seems to be the de facto zip standard. +1
Billy ONeal
For RAR you cannot create/modify an archive but you can 'unrar-it' using the freeware UnRAR lib from: http://www.rarlab.com/rar_add.htm
Eugen Constantin Dinca
A: 

Codeka is correct in recommending zlib, but if you're on Windows, you might want to take a look at ZipUtils, which is zlib repackaged with a simpler interface and a few bells and whistles added.

Billy ONeal
+1  A: 

zlib and minizip, yes. minizip was last updated in 2005. Some facts about version 1.01e:

  1. This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g, WinZip, InfoZip tools and compatible.
  2. Multi volume ZipFile (span) are not supported.
  3. Encryption compatible with pkzip 2.04g only supported
  4. Old compressions used by old PKZip 1.x are not supported

boost::iostreams also is a good choice. Open Source Ogre3d has implementation of zip decompressor, you can read it.

topright