MyUnZip.cpp
上传用户:hzweiye
上传日期:2022-05-26
资源大小:4688k
文件大小:1k
源码类别:

压缩解压

开发平台:

Visual C++

  1. // MyUnZip.cpp : Defines the entry point for the console application.
  2. //
  3. #include "stdafx.h"
  4. #include "MyUnZip.h"
  5. #include "InfoZip\InfoZip.h"
  6. //////////////////
  7. int main(int argc, char* argv[])
  8. {
  9. // char pszCurrentDir[MAX_PATH+1],pszArchive[MAX_PATH+1],pszTargetFolder[MAX_PATH+1];
  10. CInfoZip InfoZip;
  11. if(argc<3)
  12. {
  13. printf("USAGE:%s zipfile unzippath",argv[0]);
  14. return 0;
  15. }
  16. if(access(argv[1],0)!=0)
  17. {
  18. printf("文件不存在(%s)",argv[1]);
  19. return 0;
  20. }
  21. if(access(argv[2],0)!=0)
  22. {
  23. if(!CreateDirectory(argv[2],NULL))
  24. {
  25. printf("创建文件输出目录失败(%s)",argv[2]);
  26. return 0;
  27. }
  28. }
  29. if (!InfoZip.InitializeUnzip())
  30. {
  31. printf("Must be initialized");
  32. return 0;
  33. }
  34. if (!InfoZip.ExtractFiles(argv[1],argv[2]))
  35. {
  36. printf("Files not added");
  37. return 0;
  38. }
  39. if (!InfoZip.FinalizeUnzip())
  40. {
  41. printf("Cannot finalize");
  42. return 0;
  43. }
  44. printf("完成解压!");
  45. return 0;
  46. }