zlib file inflation
When inflating a file that was compressed using zlib, how do i know how bug the buffer should be to hold the uncompressed data?
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:
[edited by - Spudder on February 28, 2004 4:51:46 PM]
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 infounzGetCurrentFileInfo(g_ZFile, &g_ZFileInfo, NULL, 0, NULL, 0, NULL, 0);//create a buffer big enough for the filevoid *g_pBuffer = malloc(g_ZFileInfo.uncompressed_size);
[edited by - Spudder on February 28, 2004 4:51:46 PM]
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]
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]
all you need to do is to link to either the zlib static or dll library and include unzip.h and thats it
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.
Thanks for the info so far, quite helpful.
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement