符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
#include#include #include #include #include #include #include #include #include #include #include "minizip/zip.h" #include "minizip/unzip.h" using namespace std; void EnumDirFiles(const string& dirPrefix,const string& dirName,vector & vFiles) { if (dirPrefix.empty() || dirName.empty()) return; string dirNameTmp = dirName; string dirPre = dirPrefix; if (dirNameTmp.find_last_of("/") != dirNameTmp.length() - 1) dirNameTmp += "/"; if (dirNameTmp[0] == '/') dirNameTmp = dirNameTmp.substr(1); if (dirPre.find_last_of("/") != dirPre.length() - 1) dirPre += "/"; string path; path = dirPre + dirNameTmp; struct stat fileStat; DIR* pDir = opendir(path.c_str()); if (!pDir) return; struct dirent* pDirEnt = NULL; while ( (pDirEnt = readdir(pDir)) != NULL ) { if (strcmp(pDirEnt->d_name,".") == 0 || strcmp(pDirEnt->d_name,"..") == 0) continue; string tmpDir = dirPre + dirNameTmp + pDirEnt->d_name; if (stat(tmpDir.c_str(),&fileStat) != 0) continue; string innerDir = dirNameTmp + pDirEnt->d_name; if (fileStat.st_mode & S_IFDIR == S_IFDIR) { EnumDirFiles(dirPrefix,innerDir,vFiles); continue; } vFiles.push_back(innerDir); } if (pDir) closedir(pDir); } int writeInZipFile(zipFile zFile,const string& file) { fstream f(file.c_str(),std::ios::binary | std::ios::in); f.seekg(0, std::ios::end); long size = f.tellg(); f.seekg(0, std::ios::beg); if ( size <= 0 ) { return zipWriteInFileInZip(zFile,NULL,0); } char* buf = new char[size]; f.read(buf,size); int ret = zipWriteInFileInZip(zFile,buf,size); delete[] buf; return ret; } int main(int argc, char *argv[]) { if (argc < 3) { cout<<"usage: mini from to"< vFiles; EnumDirFiles(dirPrefix,dirName,vFiles); vector ::iterator itF = vFiles.begin(); for(;itF != vFiles.end(); ++itF) { zip_fileinfo zFileInfo = { 0 }; int ret = zipOpenNewFileInZip(zFile,itF->c_str(),&zFileInfo,NULL,0,NULL,0,NULL,0,Z_DEFAULT_COMPRESSION); if (ret != ZIP_OK) { cout<<"openfile in zip failed"< target=mini lib=-lminizip -laes -lz libpath=-L/usr/local/lib incpath=-I/usr/local/include ${target}: g++ main.cpp -g -o $@ ${lib} ${libpath} ${incpath} clean: -rm ${target}
新闻名称:minizipc++压缩文件及文件夹
分享地址:http://bjjierui.cn/article/ihhigs.html