My question is simple, I have a bunch of files (images and plain texts) in one folder, is there a way to pack all those files in just one file (a raw file with a headder or preferibly zipped) and unpack it on runtime to use in another program?

For example, I have images, a 3d model and some text files, I want to pack them in one archive and then being able to unpack the files from the archive for use in another program that I already have that can load and manage those files.

有帮助吗?

解决方案

I have used zziplib ( http://zziplib.sourceforge.net/ ) in the past. I had no particular difficulty integrating it into my cross platform (windows, Linux, Mac OSX). I simply used a different extension to make it clear this was to be used with my program. So I could rename my *.lvl files to *.zip and open the file with 7zip, winrar, file-roller, etc...

There are many other libraries too:

Zlib - http://zlib.net/ - Doesn't have a file format but does use gzip.

7-zip SDK - http://www.7-zip.org/sdk.html - Supports LZMA, zip, bzip2 and a few others.

Whatever you pick, be careful with licenses. zlib is known for its very liberal license, but some of these might be under the GPL, which depending on how you use it might require source distribution.

You might also want to check out: Compression Libraries For C++

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top