Advertisement
Gamer_Z

Untitled

Feb 22nd, 2012
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. ZIP UTILS
  2. -----------
  3. by Lucian Wischik, June 2004 - July 2005
  4.  
  5.  
  6. These files are a simple way to add zip/unzip functionality to
  7. your windows programs, both win32 and windows-ce.
  8.  
  9.  
  10. For unzipping, add "unzip.cpp" to your project. Then, for example,
  11. #include "unzip.h"
  12. //
  13. HZIP hz = OpenZip("c:\\stuff.zip",0);
  14. ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;
  15. for (int i=0; i<numitems; i++)
  16. { GetZipItem(hz,i,&ze);
  17. UnzipItem(hz,i,ze.name);
  18. }
  19. CloseZip(hz);
  20.  
  21.  
  22.  
  23.  
  24. For zipping, add "zip.cpp" to your project. (You can add just one of
  25. zip/unzip, or both; they function independently and also co-exist.)
  26. #include "zip.h"
  27. //
  28. HZIP hz = CreateZip("c:\\simple1.zip",0);
  29. ZipAdd(hz,"znsimple.bmp", "c:\\simple.bmp");
  30. ZipAdd(hz,"znsimple.txt", "c:\\simple.txt");
  31. CloseZip(hz);
  32.  
  33.  
  34.  
  35. There is lot of flexibility... When you unzip, the zipfile can
  36. be a handle or a file on disk or a block of memory or a resource.
  37. And when you unzip the items, you can unzip them directly
  38. to a handle or diskfile or pipe or block of memory. You might
  39. even spawn off a thread to play wav files, connected via a pipe,
  40. and unzip directly from a resource into that pipe.
  41. Similarly you can create a zip in different ways (even creating it
  42. as a dynamically growable buffer that's backed by the system paging
  43. file), and the items you add can come from anywhere.
  44.  
  45. The functions all support unicode filenames. And the final '0' argument
  46. in OpenZip/CreateZip is for a password, in case of encryption.
  47.  
  48. For more information, see the header files or the example source code.
  49. The example comes with project files for Visual Studio .NET and
  50. Embedded Visual C++3 and Borland C++Builder6.
  51.  
  52.  
  53. The actual core source code for zipping and unzipping comes from
  54. www.info-zip.org and www.gzip.org/zlib, by Jean-Loup Gailly and Mark
  55. Adler and others, and is freely available at the respective
  56. websites. All I did was repackage them and add some small extras.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement