qt - .DAT 文件未在 qt 中使用 Quazip 库提取
问题描述
我正在尝试使用 Qt 5.14 中的 Quazip 库提取 .DAT 文件。我将这个 quazip 库集成到我的项目中,并尝试使用它来提取文件。.txt 文件被提取,但 .DAT 文件未被提取。.DAT 文件已创建,但不包含任何数据。这是我的源代码
bool fileHelper::extractAll( QString folderPath, QString filePath ) {
QuaZip zip(filePath);
zip.open(QuaZip::mdUnzip);
bool isSuccess = false;
for(bool f=zip.goToFirstFile(); f; f=zip.goToNextFile())
{
// set source file in archive
QString filePath = zip.getCurrentFileName();
QuaZipFile zFile( zip.getZipName(), filePath );
// open the source file
zFile.open( QIODevice::ReadOnly );
// create a bytes array and write the file data into it
//QByteArray ba = zFile.read()
QByteArray ba = zFile.readAll();
// close the source file
zFile.close();
// set destination file
//QFile dstFile( getfileStoreRootDir()+filePath );
QFile dstFile( folderPath+filePath );
qDebug() << "dstFile :" << dstFile;
// open the destination file
dstFile.open( QIODevice::WriteOnly | QIODevice::Text );
// write the data from the bytes array into the destination file
dstFile.write( ba.data() );
//close the destination file
dstFile.close();
//mark extraction sucess
isSuccess = true;
}
zip.close();
return isSuccess; }
请告诉我我做错了什么或任何其他额外的标志或需要它的东西。
解决方案
推荐阅读
- css - 字体系列在 ListItemText 中不起作用
- python - Django inline 没有 ForeignKey 但有一个?
- mysql - 获取分组前的行数
- reactjs - 公共文件夹中的文件更改时如何防止反应页面刷新
- postgresql - 有没有办法限制或限制 PostgreSql 中的用户或连接?
- javascript - reactjs-components@5.0.3 需要一个 cnvs@1.1.14 的对等点,但没有安装
- javascript - ApexCharts:与分组图表重叠的工具提示
- python - 字母组合“'”+“t”触发 Spyder 运行
- selenium - 如何在单击添加按钮时使用 Selenium 将登录 ID 和密码传递给 Chrominum 弹出验证器
- python - 在python中从RAM中读取数据