2000万优秀解决方案库,覆盖所有编程及软件开发类,极速查询
今日已更新 2172 篇代码解决方案
2024-07-26 09:42:19 218人阅读
#include <zzip/zzip.h> #include <zlib.h> #include <zip.h> #include <unzip.h> #include <string> #include <map> #ifdef _DEBUG#pragma comment( lib, "zlib_d.lib") #pragma comment( lib, "zzip_d.lib") #pragma comment( lib, "minizip_d.lib") #else #pragma comment( lib, "zlib.lib" ) #pragma comment( lib, "zzip.lib" ) #pragma comment( lib, "minizip.lib" ) #endif#define SAFE_DELETEARRAY(p) if(p != NULL) { delete[] (p); (p) = NULL; }; void UnzipAndZip( const char* pScrFileName, const char* pDstFileName ) { struct FILE_DESC { unsigned char* pData; size_t DataSize; }; std::map<std::string, FILE_DESC> mapFileStreams; ZZIP_DIR* pZipDir = zzip_opendir( pScrFileName ); ZZIP_DIRENT* pZipDirent = NULL; while( pZipDirent = zzip_readdir( pZipDir ) ) { size_t length = strlen(pZipDirent->d_name); if( length > 0 ) { if( pZipDirent->d_name[length - 1] != ‘//‘ && pZipDirent->d_name[length - 1] != ‘/‘ ) { ZZIP_FILE* pZipFile = zzip_file_open( pZipDir, pZipDirent->d_name, ZZIP_CASELESS ); if( pZipFile != NULL ) { ZZIP_STAT sz; memset( &sz, 0, sizeof(sz) ); zzip_file_stat( pZipFile, &sz ); if( sz.st_size > 0 ) { unsigned char* pBuffer = new unsigned char[sz.st_size]; zzip_file_read( pZipFile, pBuffer, sz.st_size ); FILE_DESC data = http://www.mamicode.com/{ pBuffer, sz.st_size }; >
使用zzip和minizip解压缩文件
https://www.u72.net/daima/8uab.html
联系 我们
回到 顶部