QuaZip - 受密码保护的文件
QuaZip - Password protected files
我正在查看从 .zip 中提取受密码保护的文件,发现 QuaZip 具有以下功能,但没有关于如何处理加密文件的代码示例或其他文档。
QuaZip中的加密文件一定可以解压吗?如果是,请提供一些示例:)
bool open (OpenMode mode, const char *password)
Opens a file for reading.
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Argument password specifies a password to decrypt the file. If it is
NULL then this function behaves just like open(OpenMode).
References open().
Referenced by open().
试试这个:
QuaZip zip("file.zip"); // put real zip file name here
zip.open(QuaZip::mdUnzip);
QuaZipFile file(&zip);
for(bool f=zip.goToFirstFile(); f; f=zip.goToNextFile()) {
file.open(QIODevice::ReadOnly, "password"); // put real password here
file.readData(data, maxSize);
// process data from archive
file.close();
}
zip.close();
我正在查看从 .zip 中提取受密码保护的文件,发现 QuaZip 具有以下功能,但没有关于如何处理加密文件的代码示例或其他文档。
QuaZip中的加密文件一定可以解压吗?如果是,请提供一些示例:)
bool open (OpenMode mode, const char *password)
Opens a file for reading.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Argument password specifies a password to decrypt the file. If it is NULL then this function behaves just like open(OpenMode).
References open().
Referenced by open().
试试这个:
QuaZip zip("file.zip"); // put real zip file name here
zip.open(QuaZip::mdUnzip);
QuaZipFile file(&zip);
for(bool f=zip.goToFirstFile(); f; f=zip.goToNextFile()) {
file.open(QIODevice::ReadOnly, "password"); // put real password here
file.readData(data, maxSize);
// process data from archive
file.close();
}
zip.close();