当前位置: 首页 > news >正文

金华网站设计公司上海网站推广方法

金华网站设计公司,上海网站推广方法,在中国如何申请域名,国内搜索网站排名zlib库可在git上自己clone下来然后使用cmake工具生成解决方案#xff0c;编译、生成zlib二进制文件。然后将zlib库引入项目#xff1a; //zlib库支持 #include ../zlib/include/zlib.h #ifdef _DEBUG #pragma comment(lib, ../zlib/lib/zlibd.lib) …zlib库可在git上自己clone下来然后使用cmake工具生成解决方案编译、生成zlib二进制文件。然后将zlib库引入项目 //zlib库支持 #include ../zlib/include/zlib.h #ifdef _DEBUG #pragma comment(lib, ../zlib/lib/zlibd.lib) #else #pragma comment(lib, ../zlib/lib/zlib.lib) #endif定义一个文件结构 typedef struct tagZipperFileInfo {char m_szLocalPath[MAX_PATH];char m_szRootPath[MAX_PATH];char m_szFileName[MAX_PATH];size_t m_FileSize; }ZipperFileInfo;压缩文件相关 /* * strFolder 需要被压缩的文件夹 * strOut 保存的文件 */ void CompressFolder(std::string strFolder, std::string strOut) {//创建压缩的目标文件std::ofstream dest(strOut, std::ios::binary | std::ios::trunc);if (!dest.is_open()) {//errorreturn;}dest.close();std::vectorZipperFileInfo vecZipperFiles;//遍历文件夹下的所有文件OperateFolder(strFolder, strFolder, vecZipperFiles);//压缩文件gzFile gzOut gzopen(strOut.c_str(), wb);CompressFiles(vecZipperFiles, gzOut);gzclose(gzOut); }void OperateFolder(std::string strFolder, std::string strRoot, std::vectorZipperFileInfo vecZipperFiles) {std::string searchPath strFolder \\*;WIN32_FIND_DATAA findData;HANDLE hFind FindFirstFileA(searchPath.c_str(), findData);if (hFind INVALID_HANDLE_VALUE) {//errorreturn;}do {if (findData.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY) {if (strcmp(findData.cFileName, .) ! 0 strcmp(findData.cFileName, ..) ! 0) {std::string subFolderPath strFolder \\ findData.cFileName;OperateFolder(subFolderPath, strRoot, vecZipperFiles);}}else {std::string strLocalPath strFolder \\ findData.cFileName;std::string strFileRootPath strFolder;std::string strFileName findData.cFileName;//需要根据strRoot分割出来需要压缩文件的相对路径名std::string strTempPath;size_t start strFileRootPath.find(strRoot);if (start std::string::npos)strTempPath strFileRootPath; // 如果找不到根路径则返回完整路径else{if (strFileRootPath strRoot)strTempPath strFileRootPath.substr(start strRoot.length());elsestrTempPath strFileRootPath.substr(start strRoot.length() 1);}ZipperFileInfo zipperFile;memcpy(zipperFile.m_szRootPath, strTempPath.c_str(), MAX_PATH);memcpy(zipperFile.m_szLocalPath, strLocalPath.c_str(), MAX_PATH);memcpy(zipperFile.m_szFileName, strFileName.c_str(), MAX_PATH);//计算文件大小std::ifstream in(strLocalPath, std::ios::binary | std::ios::ate);size_t fileSize in.tellg();in.seekg(0);in.close();zipperFile.m_FileSize fileSize;vecZipperFiles.push_back(zipperFile);}} while (FindNextFileA(hFind, findData) ! 0);FindClose(hFind); }压缩文件 void CompressFiles(std::vectorZipperFileInfo vecZipperFiles, gzFile gzOut) {int nFileCount vecZipperFiles.size();gzwrite(gzOut, reinterpret_castconst void*(nFileCount), 4);gzwrite(gzOut, reinterpret_castconst void*(vecZipperFiles.data()), vecZipperFiles.size() * sizeof(ZipperFileInfo));//再往压缩文件中写入需要压缩为文件内容for (int i 0; i vecZipperFiles.size(); i){std::string strLocalPath vecZipperFiles[i].m_szLocalPath;std::ifstream infile(strLocalPath, std::ios::binary);char buffer[4096];while (infile){infile.read(buffer, sizeof(buffer));auto bytes infile.gcount();if (bytes 0){//写入目标压缩文件gzwrite(gzOut, buffer, bytes);}}infile.close();} }文件解压相关 //strFilePath 压缩文件路径 void DecompressFiles(std::string strFilePath) {gzFile gzin gzopen(strFilePath.c_str(), rb);if (!gzin) return; //open errorint nFileCount 0;gzread(gzin, nFileCount, 4); //读取压缩的文件数量// 读取文件列表信息std::vectorZipperFileInfo vecZipperFiles;ZipperFileInfo zipperFile;for (int i 0; i nFileCount; i){if (gzread(gzin, zipperFile, sizeof(ZipperFileInfo)) sizeof(ZipperFileInfo))vecZipperFiles.push_back(zipperFile);}SStringW sstrAppPath CGlobalUnits::GetInstance()-m_sstrAppPath;std::string strAppPath S_CW2A(sstrAppPath);//先创建个输出目录size_t szPos strFilePath.find_last_of(\\);if (szPos ! std::string::npos){std::string strTmp strFilePath.substr(szPos 1);//分解出namesize_t szName strTmp.find_last_of(.);if (szName ! std::string::npos){std::string strName strTmp.substr(0, szName);strAppPath strName;}}CreateDirectoryA(strAppPath.c_str(), NULL);//解压文件for (int i 0; i vecZipperFiles.size(); i){ZipperFileInfo info vecZipperFiles[i];std::string strRoot info.m_szRootPath;std::string strPath;if (strRoot ) //根目录下strPath strAppPath \\ info.m_szFileName;else{CreateFolder(strAppPath, strRoot);strPath strAppPath \\ strRoot \\ info.m_szFileName;}std::ofstream outFile(strPath, std::ios::binary);if (!outFile) continue; //error char buffer[4096];size_t fileSize info.m_FileSize;while (fileSize 0){size_t bytesToRead std::min(static_castsize_t(4096), fileSize);int bytesRead gzread(gzin, buffer, bytesToRead);if (bytesRead 0) break; //read erroroutFile.write(buffer, bytesRead);fileSize - bytesRead;}outFile.close();}gzclose(gzin); }递归生成压缩文件中的目录结构 /* * strRoot 解压缩的目标目录 * strDir 压缩文件的相对路径 */ void CreateFolder(std::string strRoot, std::string strDir) {size_t szPos strDir.find_first_of(\\);if (szPos ! std::string::npos){std::string strName strDir.substr(0, szPos);std::string strPath strRoot \\ strName;CreateDirectoryA(strPath.c_str(), NULL);std::string strSubName strDir.substr(szPos 1);std::string strTempRoot strRoot \\ strName;CreateFolder(strTempRoot, strSubName);}else{std::string strPath strRoot \\ strDir;CreateDirectoryA(strPath.c_str(), NULL);} }
http://www.hkea.cn/news/14433039/

相关文章:

  • 南通网站建设方案书厦门网站建设建站中心
  • 招聘织梦网站合肥室内设计公司有哪些
  • 展示型网站建设报价做网站维护承包合同
  • 淘宝网站c#设计怎么做如果做公司网站
  • 济南咨询行业网站开发免费的产品推广平台
  • 网站维护有多长时间中国最大的外贸平台
  • 自己设计的网站如何推广3d建模要学多久
  • 网站建设的目的和作用网站推广方式有哪些
  • 网站建设 蜀美网络百度seo排名优化是什么
  • 粉末涂料 技术支持 东莞网站建设关于网站建设的调查问卷
  • 南宁seo网站排名优化主页页面
  • 免费二维码制作网站手机建站网
  • wordpress+更新+慢网站建设哈尔滨网站优化4
  • 织梦免费网站模块下载地址长沙软件公司排行榜
  • wap织梦手机网站站长统计 网站统计
  • 设计公司灰白色调网站phpstudy 做网站
  • 高端网站开发地址西安公司注册代理
  • 江苏省建设安全协会网站wordpress后台登不进去
  • 合肥市建设通网站茂名公司制作网站
  • 做网站月薪资多少钱凡科网后台登录
  • 网站建设代码大全wordpress编辑php.ini
  • 求一个全部用div做的网站验证码注册
  • 能打开各种网站的浏览器微信登录入口官网
  • 建设户外腰包网站冷门行业做网站的优势
  • 青岛网站产品图片设计新手怎样做网络营销推广
  • 环保局网站设计方案新加坡做网站的价格
  • 网站白名单是什么意思婚庆公司收费价格表
  • 网站禁止火车头采集郑州市网站制作公司
  • 建设部四库一平台查询网站高端网站建设一般多少钱
  • 如何做好网站宣传网站建设全