TA的每日心情 | 擦汗 2014-7-21 21:38 |
---|
签到天数: 7 天 [LV.3]偶尔看看II 鲜花( 0) 鸡蛋( 0)
|
- #include "stdafx.h"
- #include "ZipArchive/ZipArchive.h"
- #include <iostream>
- #include <list>
- #include <string>
- #include <sstream>
- const char* const PACK_PASSWORD = "#7qlcRkfanwlrodldi#";
- int main(int argc, char *argv[])
- {
- try
- {
- for (int i = 1; i < argc; i++)
- {
- CZipArchive mZip;
- // Nome do arquivo que irá ser extraido
- char msg[2048] = "";
- sprintf(msg, "Extraindo arquivo: %s.", argv[i]);
- std::cout << msg << std::endl;
- mZip.Open(argv[i], CZipArchive::zipOpen);
- mZip.SetPassword(PACK_PASSWORD);
- for (int x = 0; x < mZip.GetCount(); ++x)
- {
- CZipFileHeader header;
- mZip.GetFileInfo(header, static_cast<WORD>(x));
- if (header.IsDirectory())
- continue;
- printf("Extraindo: %s\n", header.GetFileName().c_str());
- mZip.ExtractFile(x, "output");
- }
- mZip.Close();
- }
- }
- catch( CZipBaseException & ex )
- {
- std::cout << ex.what() << std::endl;
- }
- return 0;
- }
复制代码 |
|