Zlib - compressing multiple files into one compressed file?

Started by
7 comments, last by JJJohan 15 years ago
I've spend quite a few hours looking for a bunch of zlib resources since I have no idea what to actually use.. Anyway, I downloaded zlib along with zlibtool.zip elsewhere, which basically lets me do this to compress and uncompress files:

#include "zlibengn.h"

#pragma comment(lib,"zdll.lib")

ZlibEngine z;

int main(int argc, char* argv[])
{
	z.compress( "zlib.h","zlib.h__");
	z.decompress( "zlib.h__", "test.h");
	return 0;
}
Now the question is, how would I go at compressing multiple files into one file, then obviously decompressing them all again in their original place? I tried using a folder which doesn't seem to work, and I don't arrays are working either. If I can't use zlibtools, then please be so kind to redirect me to what I need to use. I'd really like to use this method to store a hefty number of game resources into a single compress folder, then if needed uncompress them while the game loads etc. (or just load them while compressed if that's possible)
Advertisement
I generally use OS tools to create the zip files and PhysFS to read the archives in my applications.
I can't seem to find any way to compile physfs, seeing as it doesn't come with any sort of installation instructions :(. I just get spammed with 3 errors which I can't seem to figure out when I try to compile physfs.c

1>------ Build started: Project: physfs, Configuration: Debug Win32 ------1>Compiling...1>physfc.cpp1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(177) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(327) : warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(157) : see declaration of 'strncpy'1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(560) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(566) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(567) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(79) : see declaration of 'strcat'1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(626) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'sprintf'1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(650) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(79) : see declaration of 'strcat'1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(672) : error C2440: '=' : cannot convert from 'const char *' to 'char *'1>        Conversion loses qualifiers1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(675) : error C2440: '=' : cannot convert from 'const char *' to 'char *'1>        Conversion loses qualifiers1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(1444) : error C2440: '=' : cannot convert from 'void *' to 'char *'1>        Conversion from 'void*' to pointer to non-'void' requires an explicit cast1>Build log was saved at "file://c:\Users\JJJohan\Documents\Visual Studio 2008\Projects\physfs\physfs\Debug\BuildLog.htm"1>physfs - 3 error(s), 7 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Minizip addon for zlib
________________________________Blog...
Quote:Original post by JJJohanI just get spammed with 3 errors which I can't seem to figure out when I try to compile physfs.c

Are you really compiling physfs.c file? Output from Visual Studio build log shows that you are compiling physfc.cpp file. What is this file? Why are you not using original physfs.c file?
Now I'm just getting the following message when compiling the original physfs.c(whoops with the first time)

1>Linking...1>   Creating library C:\Users\JJJohan\Documents\Visual Studio 2008\Projects\physfs\Debug\physfs.lib and object C:\Users\JJJohan\Documents\Visual Studio 2008\Projects\physfs\Debug\physfs.exp1>LINK : fatal error LNK1561: entry point must be defined


But other than that, even if I do manage to compile it, what am I supposed to do with it? There's very few details on usage anywhere.
Hi,
as far as I know, zlib just compress only one file. So, the usual approach in the linux world is to pack the files with tar and then compressing the tar file.

http://www.zlib.net/zlib_how.html
The PhysFS archive comes with a text file INSTALL.txt. Are you following the instructions on how to build it there? Also, a PhysFS tutorial is available on the PhysFS website. Funny enough, it's listed under the section labeled "Documentation".
Thanks, I feel stupid for having missed that, I take back about the lack of documentation. I was rather stressed and had spend the entire previous day finding a suitable solution so I wasn't particularly relaxed in the morning.

This topic is closed to new replies.

Advertisement