一个很好用的zip/unzip类

介绍了一个好用的压缩/解压缩类,适用于Windows程序,包括Win32和Windows CE。通过简单的API即可实现文件的压缩与解压,支持Unicode文件名,并提供了加密选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

好用的压缩/解压缩类。

下载页面:http://www.wischik.com/lu/programmer/zip_utils.html 相关页面:http://www.codeproject.com/useritems/zip_utils.asp  

ZIP UTILS ----------- by Lucian Wischik, June 2004 - July 2005 These files are a simple way to add zip/unzip functionality to your windows programs, both win32 and windows-ce. For unzipping, add "unzip.cpp" to your project. Then, for example,

  #include  " unzip.h "    //   HZIP hz  =  OpenZip( " c:/stuff.zip " , 0 );   ZIPENTRY ze; GetZipItem(hz, - 1 , & ze);  int  numitems = ze.index;    for  ( int  i = 0 ; i < numitems; i ++ )   { GetZipItem(hz,i, & ze);     UnzipItem(hz,i,ze.name);   }   CloseZip(hz);

For zipping, add "zip.cpp" to your project. (You can add just one of zip/unzip, or both; they function independently and also co-exist.)

  #include  " zip.h "    //   HZIP hz  =  CreateZip( " c:/simple1.zip " , 0 );   ZipAdd(hz, " znsimple.bmp " " c:/simple.bmp " );   ZipAdd(hz, " znsimple.txt " " c:/simple.txt " );   CloseZip(hz);

There is lot of flexibility... When you unzip, the zipfile can be a handle or a file on disk or a block of memory or a resource.And when you unzip the items, you can unzip them directly to a handle or diskfile or pipe or block of memory. You might even spawn off a thread to play wav files, connected via a pipe,and unzip directly from a resource into that pipe. Similarly you can create a zip in different ways (even creating it as a dynamically growable buffer that's backed by the system paging file), and the items you add can come from anywhere.

The functions all support unicode filenames. And the final '0' argument in OpenZip/CreateZip is for a password, in case of encryption.

For more information, see the header files or the example source code. The example comes with project files for Visual Studio .NET and Embedded Visual C++3 and Borland C++Builder6.

The actual core source code for zipping and unzipping comes from www.info-zip.org and www.gzip.org/zlib, by Jean-Loup Gailly and Mark Adler and others, and is freely available at the respective websites. All I did was repackage them and add some small extras.  

csdn download http://download.youkuaiyun.com/source/500080

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值