Jump to content
  • Advertisement
Sign in to follow this  
orphankill

zlib Questions

This topic is 3718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

To someone with experience using zlib (v1.2.3): I can successfully compress/decompress data in ram or on the disk using zlib, and all goes well. What I'm trying to do is create a zip file that I can traverse in memory and then load the appropriate file for my game. A simple example of what I'm trying to do: Archive.gz -Graphics folder -Image.bmp -Sound folder -Sound.wav etc. My problem is, how do I use zlib to read through folders in an archive? Once I've opened and decompressed my .gz file, how do I access the data? Thanks, Orphankill

Share this post


Link to post
Share on other sites
Advertisement
If you have the zlib source, there's a minizip library in the contrib directory to read/write .zip files. I use it for my game's resource files, and it works well for me. If you actually want to keep the zip file itself in memory, you can provide your own IO functions as well.

Share this post


Link to post
Share on other sites
Thanks for pointing that out, I just looked over zip.h and it looks fine except I'm wondering if it will allow me to access sub folder of a zip file since the functions never ask for a path, just file names. I'm sure it does though considering it would be pretty useless otherwise. Thank you very much, I think you solved my problem.

Share this post


Link to post
Share on other sites
I don't believe there is a directory structure as such. Each file name returned contains its full path. I usually just cache the directory structure in memory myself, along with the file positions in the zip, and I can quickly read whichever file I need.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!