网天下信息技术有限公司网站上海家装公司排名
news/
2025/9/28 10:49:12/
文章来源:
网天下信息技术有限公司网站,上海家装公司排名,自己在家怎么学编程,南京宣传片制作公司向已有ZIP中追加文件#xff0c;使用qt自带的QZipWriter和quazip库均失败了#xff0c;要么格式损坏、要么ZIP里面的原有的文件清空了
使用7z.exe可以实现 : 指令 7z.exe a A.zip B.txt#xff0c;使用代码控制如下
#include QCoreApplication
#include QFile…向已有ZIP中追加文件使用qt自带的QZipWriter和quazip库均失败了要么格式损坏、要么ZIP里面的原有的文件清空了
使用7z.exe可以实现 : 指令 7z.exe a A.zip B.txt使用代码控制如下
#include QCoreApplication
#include QFileInfo
#include QProcess
#include QDebugint addFileToZip(const QString zipFilePath, const QString fileToAddPath){QString sevenZipPath F:\\data\\7z\\7z.exe;QProcess process;process.setWorkingDirectory(QFileInfo(sevenZipPath).absolutePath());QStringList arguments;arguments a zipFilePath fileToAddPath;process.start(sevenZipPath, arguments);process.waitForFinished();if (process.exitCode() ! 0) {qDebug() 7z.exe process failed: process.readAllStandardError();return -1;}qDebug() File added to ZIP successfully.;return 0;
}
int main(int argc, char *argv[]) {//7z.exe a A.zip B.txtQString zipFilePath F:\\data\\A.zip;QString fileToAddPath F:\\data\\B.txt;addFileToZip(zipFilePath, fileToAddPath);return 0;
}
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/920526.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!