compressed files

Pages: 12
hi
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.
http://www.codeproject.com/Articles/7530/Zip-Utils-clean-elegant-simple-C-Win32
I think zlib is a good compression library. http://zlib.net/
@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???)
well
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:
1
2
3
4
5
6
7
# ifndef __int64
#  define __int64 long long
# endif
.
.
.
typedef __int64 lutime_t;    

no idea???
please help me ! :D
anyone???
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: http://zlib.net/
Get the tutorial for it here: http://zlib.net/zlib_how.html

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.
thanks.

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.

http://zlib.net/zlib-1.2.7.tar.gz

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:
http://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch
http://en.wikibooks.org/wiki/Data_Compression
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