Q: When do I need to purchase the commercial license?
Q: Of what size should be a single volume in a multi-disk archive created in the TD span mode ?
Q: How can I detect the disk spanning mode of an archive?
Q: How to integrate the library with the sample application?
Q: Why the library doesn't want to extract archives (mostly old)?
Q: I want to create an archive that will be readable under Unix/Linux.
Q: How can I use UNC path with CZipArchiveExtractFile function ?
Q: How can I extract or delete files that matches a specified wildcard pattern ?
Q: Why an exception is thrown when I call CZipArchive::CloseFile ?
Q: I experience linking problems. What to do?
A:
A: The ZipArchive library is distributed under GNU GPL which implies that it can only be used with software that is licensed under conditions compliant with the GPL. It means that you need to provide a customer with the source code of your software that uses the library. The commercial license removes this obligation. You can find out more at Alternative license for use with proprietary software.
Q: When I open a multi-disk archive (Pkzip mode) and the last disk is not in the drive, I receive the CZipException::cdirNotFound exception. How to detect whether the last disk is in the drive?
A: The last disk can not be detected before opening an archive. The only way to prevent the program from failing when an incorrect disk is inserted is to catch the CZipException::cdirNotFound exception while opening the archive and keep prompting the user to insert the last disk into the drive. Please see the sample application on how it can be done in details.
Q: Of what size should be a single volume in a multi-disk archive created in the TD span mode?
A: The size of the volume may be from 1 byte to the maximum integer value, and the bigger - the faster is creation and extraction (no file changes meantime), but the size of the whole archive is the same. The optimal solution is to set it to about the size of the diskette (a little less to be comfortable when there are bad sectors found on the disk) to allow the future conversion to PKZIP span mode.
Q: How can I detect the disk spanning mode of an archive?
A: You need to open the archive and the call CZipArchive::GetSpanMode. When opening the archive in tdSpan mode on a removable device, you should set iVolumeSize to a non-zero value while opening the archive (with CZipArchive::Open). There is no universal way to distinguish a PKSpan archive from a TDSpan archive on a removable device, because they have identical internal structure.
Q: How to integrate the library with the sample application?
A:The usual way is to put ZipArchive library at the same directory level what your project is, and then use one of the integration methods. Make a directory structure like this:
---
    |-ZipArc           // the application project
    |-ZipArchive     // the ZipArchive library
You can now follow the integration method 1 or 2 (the easier one).
Q: Why the library doesn't want to extract archives (mostly old)?
A: The common reason is that the data is compressed using imploded method (usually with old archivers). The only methods supported by the zlib library are deflation which is the most commonly used by archivers and storing which is in fact not a compression method. You can use a compiled ZipArc application to find out what method the file was compressed with (View->File Info)
Q: In CZipArchive::AddNewFile and CZipArchive::ExtractFile I want to use partial path for the filename inside the archive. For example:
When I compress some directory, like this: c:\program files\example (full directory path: c:\program files\example\text\txt) it comes with the whole path. I would like that the zip only get the EXAMPLE\text\txt path.
A: You can set bFullPath argument to false
in these functions and set the beginning part of the path that you commonly want to eliminate with CZipArchive::SetRootPath function. In the example above you'd set it to c:\program files\ (the path separator at the end is added automatically).
Q: I want to create an archive that will be readable under Unix/Linux.
A: Inside the archive there is an information stored about the system it was created under. It helps converting the file attributes that are stored inside the archive to file attributes that are used on the system on which the file is extracted. Some Unix archivers cannot convert Windows attributes to Unix, so that it is needed to create the archive with the Unix attributes already (and the internal info about the system set to a Unix value). To achieve that, simply call CZipArchive::SetSystemCompatibility with the argument set to ZipCompatibility::zcUnix after creating the archive.
Q: How can I use UNC path with CZipArchive::ExtractFile function ?
A: You need to replace
\\\\
\\\\?\UNC\
Q: How to create a zip archive in memory and then write it to a disk or read the archive from the disk and extract from memory ?
A: See (de)compression in/from memory
Q: How can I extract or delete files that matches a specified wildcard pattern ?
A: You need to build a CZipWordArray with CZipArchive::FindMatches and then:
Q: Why an exception is thrown when I call CZipArchive::CloseFile ?
A: If you haven't exctracted all of the file contents (e.g. only the beginning) or you have encountered an exception during extraction, you need to call CZipArchive::CloseFile with bAfterException parameter set to true
or call CZipArchive::CloseFileWithNoUpdate instead.