Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-10

What is the best to compress files

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Oleg Chornenkij

Hello.
What is the best way to compress and decompress files by fpascall programs? Are there unit with good procedures to perform this. Also can these ones to work right with national coding charsets for example russian? Thanks.

__________________________________________________________ Sign-up for your own FREE Personalized http://www.mail.com/?sr=signup

Reply by email

Unknown author

Does FPC have an implementation of ZLib? IIRC it does. This should give you most of what you want.

However, if you want a completely self contained solution (ZLib seems to almost always need a DLL/So or at least include a larger presence in the final code than I needed for my purposes) you may need to look elsewhere. The method I always use is LZH compression routines that someone called the 'African Chief' has a distro of. I customized them to use TStream descendents, and wrapped them in classes, but they do work. The only interesting aspect is that you have to manage the file format yourself if you use the raw compression routines alone.

I suggest looking for another solution if you want to be able to create 'zip' or 'tar.gz' compressed files (though tar itself can be used to simplify the compression using the Chiefs code.)

I have some code somewhere for a custom self extracting compressed file format I created ages ago. If you're desperate let me know and I'll send you the compression sections - caution they are in Delphi, so you'll need to compile in Delphi come (i.e. Classes instead of Objects) etc.

Hope that helps.

Matt

Hello. What is the best way to compress and decompress files by fpascall programs?

Are there unit
with good procedures to perform this. Also can these ones to work right with national
coding charsets for example russian?

Thanks.

---------------------------------------------
This message was sent using Mistral WebMail.
http://www.mistral.co.uk/

Reply by email

Marco van de Voort
to Unknown author
Does FPC have an implementation of ZLib? IIRC it does. This should give you most of what you want.

FPC has both an interface (to DLL/shared lib) AS a native translation (called paszlib), which is selfcontained. I also heard that there is a libbz2 implementation in the works.

Reply by email

Unknown author
to Unknown author: Does FPC have an implementation of ZLib? IIRC it does. This should give you most of what…
Show quoted text 10 lines
Does FPC have an implementation of ZLib? IIRC it does. This should give you most of what you want. However, if you want a completely self contained solution (ZLib seems to almost always need a DLL/So or at least include a larger presence in the final code than I needed for my purposes) you may need to look elsewhere. The method I always use is LZH compression routines that someone called the 'African Chief' has a distro of. I customized them to use TStream descendents, and wrapped them in classes, but they do work. The only interesting aspect is that you have to manage the file format yourself if you use the raw compression routines alone.

This functionality is included in free pascal. paszlib offers compression code lik gzip does, and TCompressionStream in the FCL offers a classes wrapper around this.

There is also code (see the 'zip' package) to handle zip files.

Michael.

Reply by email

Marco van de Voort
to Unknown author
Show quoted text 5 lines
This functionality is included in free pascal. paszlib offers compression code lik gzip does, and TCompressionStream in the FCL offers a classes wrapper around this. There is also code (see the 'zip' package) to handle zip files.

Hmm, now I think about it, I also have LZH code somewhere (that works with FPC)

Reply by email