C ++ file container (e.g. zip) for easy access

I have many small files that I need to send with the application I created, and I want to archive these files to make copying and redistribution easier. I also really like the idea of ​​having them all in one place, so I need to compare the md5 of a single file only if something goes wrong.

I am thinking of a class that can load an archive and return a list of files in the archive and load the file into memory if I need to access it.

I have already searched the Internet for various methods to achieve what I want, and learned about zlib and lzma sdk. I didn’t really like both, because I really didn’t understand how portable zlib was, and I didn’t like lzma sdk, because it is just a lot, and I don’t want to explode the application because of this problem, Another drawback with zlib is that I don't have C / C ++ experience (I'm really new to C ++) so that everything is explained in the manual.

I must also add that this is a temporary critical issue. I, although for some time about introducing a simple format like tar, I can easily access the files in my application, but I just did not find the time for this.

So I'm looking for a library that allows me to access files in an archive. I would be glad if someone could point me in the right direction.

Thanks in advance, Robin.

Edit: I need an archive to access Linux and windows. Sorry, I did not mention this at the beginning.

+5
source share
6 answers

The answer depends on whether you plan to change the archive through the code after the initial creation of the archive.

If you do not need to change it, you can use TAR - this is a convenient and simple format. If you want compression, you can implement a tar.gz reader or find some library that does this (I believe there are some available, including open source).

, TAR ZIP . , SolFS CodeBase, : , , , write-once-read-many.

+2

zipping ZipUtils, zlib info- zip.

+3

zlib . ++, - . " " .

, - .

+2

Qt Windows, . , . API, .

+2

API- zlib - . . Lookat unzip.h API, . C .

, ( bin2h) . , . ifstream, istringstream .

0

Try using Quazip - it's pretty easy to use. You can use it as a stream from which you are reading a compressed file on the fly.

0
source

All Articles