Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Mulligan

zlib file inflation

This topic is 5319 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

When inflating a file that was compressed using zlib, how do i know how bug the buffer should be to hold the uncompressed data?

Share this post


Link to post
Share on other sites
Advertisement
Ive only ever used the unzip part of Zlib but if you open and locate the file inside the zip file you want to read into memory you can get the file info like so:


unz_file_info g_ZFileInfo;
unzFile g_ZipFile;

//open zip file with g_ZipFile

//locate the file you want to read into memory

//get the files info
unzGetCurrentFileInfo(g_ZFile, &g_ZFileInfo, NULL, 0, NULL, 0, NULL, 0);

//create a buffer big enough for the file
void *g_pBuffer = malloc(g_ZFileInfo.uncompressed_size);





[edited by - Spudder on February 28, 2004 4:51:46 PM]

Share this post


Link to post
Share on other sites
thanks, this looks like what im looking for.

crap, does that mean i have to include all of those source files into my project as well? I downloaded the what you told me to and have included "unzip.h", but get unresloved externals. I dont see any library files or dll's to link to my project.


[edited by - Mulligan on February 28, 2004 5:07:27 PM]

Share this post


Link to post
Share on other sites
hum, not workin for me. I''m using (what i think) is a standard zlib dll. Do i have to get a special dll for Gilles Vollants unzip stuff?

Thanks for the info so far, quite helpful.

Share this post


Link to post
Share on other sites
You can get the zip/unzip package from here, i'm using Zlib version 1.1.4 and it works perfectly for me.

EDIT: you dont need any separate library for the unzip package, all you need is to #include "unzip.h" (available from the site above) and make sure you link to the zlib library from your project

[edited by - Spudder on February 29, 2004 8:27:31 AM]

Share this post


Link to post
Share on other sites
ahha, thanks. Seems that in the newest version there is no unzip, so im using the older version that you said you were using and it works. Thanks!

Share this post


Link to post
Share on other sites

  • 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!