compressed files

Pages: 12
sry for making too many new topics today .
I'm trying to find a lib for making a compressed file, like .zip .
and i need it to support utf-8 otherwise it is useless to me.
i googled and ended up with too many libs but some of them were too complicated and the others didn't supported utf-8.

i dont mind programming the library myself, just need the whole idea.
and it's not important whether other compressing applications like 7-zip or winzip can open it or not, i just need to have some files(including some text and maybe some pictures) to be inside one file.

my application is going to read that file (like kind of res) and show some texts/images depending on those. it's not really important to be a zip, or even be compressed, the file size is not important neither.

do you know anyway for doing this?

I'm using code::blocks and windows ofc.
no idea?
any one???
This is a lightweight library that I used myself in a few projects. Works with Unicode filenames and is compatible with other archiving applications.
I think zlib is a good compression library.
@Peter87 thanks but I've tried it, not made for me :D
@modoran : I'll try that

thanks every one
a problem here,
I added those libs, worked nice but,
how can i display those .png file inside that zip?
or how can i add more "Button"s to form, depend on a file inside a zip?(i get used to an .rc file, should i switch to something else???)
I've got a bit of problem here
return (lutime_t)((i-(116444736000000000)/10000000);
I'm using code::blocks and I get error :
error: integer constant is too large for "long" type|

more info:
# ifndef __int64
#  define __int64 long long
# endif
typedef __int64 lutime_t;    

no idea???
please help me ! :D
Peter87 has already given you a common and simple library for compression.
The PNG source code also uses the same algorithm presented in zlib. In reality, it's a BMP file with an optional alpha channel, compressed similar to a zip format.

Get the source to it here:
Get the tutorial for it here:

That's about as simple as it can get, unless you want to make your own compression algorithm and implement all the assorted functions for that. If that sounds too difficult, you might not be experienced enough to deal with file de/compression. You could try to make your own assorted functions and implement that, but that'd be like reinventing the wheel.

any idea how should i make my own algorithm? I know it's like reinventing the wheel but, when you do some thing like that, it help you make more personalized apps and also, help you undrestand it
sry for too many questions,
i get confused,

i use c::b and win 7 how should i set it up with zlib?????
Get the zlib source code.

I really don't want to hold your hand all the way. Part of programming is learning how to learn properly, so try to keep up. In a professional environment, you'll have to use other libraries, and this is a good first step.

Use the source code as part of your own project, save for the samples that define the main() function.

It's important to #include "zlib.h" , it's the header that contains the information you need as far as functions and structures you'll be using.
Keep it as simple as you can. A simple compression stream and inflate/deflate functions to get you started.
Remember that this is ONLY a compression library. Unless you're using the gzip functions, you'll have to provide all 'outside' information such as file size, compression start and end markers, and number of files compressed yourself with the packaged data. You'll have to be organized.

I also want to suggest that it's not a good idea to try to make your own compression algorithm. You'd be going in the wrong direction. After all, nobody's going to re-make all the low-level microsoft systems themselves by hand simply because they don't want to learn how to use their client-sided functions.
Last edited on
any idea how should i make my own algorithm? I know it's like reinventing the wheel but, when you do some thing like that, it help you make more personalized apps and also, help you undrestand it

You can start here:
You don't know how to use a library and now want to write one based on your algorithm ? Let's be serious ............
I know how to use a library, i got like millions of errors, which i couldn't solve.
If you have millins of errors with a documented library like zlib then no, you don't know how to use a library.
That's a defeatest attitude.
Persist through those errors. Learn what each and every one of them means and why you get it if you have to. Chances are, if you're getting them, you must learn them anyway to solve them.
You cannot expect a trivial solution to pop up if you don't know what the problem is. Post some code, and we may be able to guide you.
Last edited on
If you get a lot of errors you should try to solve the first error first. The rest may very well be caused by the first error so fixing the first could fix them all.
look at 7th post of this topic please
Pages: 12