Sign in Join

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

Mailing lists / fpc-pascal / 2012-02

tzipper issue(zipper.pp)

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Tony Caduto

Hi,
I am trying to port a Delphi app to Freepascal/Lazarus. The original app zipped the contents of a memo(using vclzip) which was saved to a stream, and the zip does not get stored in a file, rather a tmemorystream, which
is then sent to a client app via a socket.

So I noticed the tzipper class in 2.6.x has the ability to save to stream and this works, but it forces you to write the zip to a file first as you have to provide a filename, and if you don't provide a filename it raises a exception.

Unless I missed something, this seems odd that you have to write to a file in order to save to a stream.

Thanks,

Snorkel

Reply by email

Malcolm Poole
to Tony Caduto
Tony Caduto wrote
The original app zipped the contents of a memo(using vclzip) which was saved to a stream, and the zip does not get stored in a file, rather a tmemorystream, whichis then sent to a client app via a socket.

The functions 'compress' and 'uncompress' in units zCompr.pas and zUncompr.pas will do what you want, although using an array of Byte instead of a TMemorystream. The units are in packages/paszlib/src in the fpc source tree.

Malcolm

Reply by email