Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > Frequently Asked Questions
Frequently Asked Questions
Applies To: All
  • If you receive LNK2005, your application probably uses different run-time libraries that the ZipArchive Library was compiled for.
  • If you receive LNK1104 (e.g. cannot open the mfc42u.lib file), you probably haven't installed Unicode libraries.
To resolve both problems, make sure you have followed the information given in Compilation of the ZipArchive Library and Integration with Applications.

How to create an archive larger than 4GB or compress more than 65535 files inside it?

The standard zip format does not support large archives or large files inside archives (even if a compressed file was smaller than 4GB). You need to use the Zip64 extensions. See Zip64 Format: Crossing the Limits of File Sizes and Number of Files and Segments for more information. This functionality is available only to the purchasers of the Full Version license.

Will the ZipArchive Library work with .NET applications?

You can use the Library with a C++/CLI application. See Compilation of the ZipArchive Library and Integration with Applications for more information.

Can I perform multithreaded operations on an archive?

Why I can't make the libray to work as expected in a MFC application?

Make sure that your application defines ZIP_ARCHIVE_MFC. See Compilation of the ZipArchive Library and Integration with Applications for more information.

Why the library doesn't extract archives?

  • Some archives are not entirely consistent in their structure, however the compressed data may be correct. Try relaxing some of the consistency checks with the CZipArchive::SetIgnoredConsistencyChecks() method.
  • Another reason is that data in the archive is compressed using imploded method (usually by old archivers). The ZipArchive Library supports only deflation (which is the most commonly used by archivers) and storing. To determine the compression method for a particular file, obtain the information data (see Requesting Information, Predicting Names and Sizes) and examine the CZipFileHeader::m_uMethod field.

Why I receive the CZipException::cdirNotFound exception when trying to open a segmented archive?

You need to open the last segment. For more information about dealing with this problem in spanned archives, see Segmented Archives: Splitting and Spanning.

How can I detect the segmentation mode of an archive?

You need to open the archive and the call the CZipArchive::GetSegmMode() method.

How to use a partial path for the filename inside an archive?

For example, if you compress a directory c:\Program Files\Example, the full path of the file inside the archive is stored. If you would like to store the path for the file, e.g. in c:\Program Files\Example\text\txt\file.dat, as Example\text\txt\file.dat, use the CZipArchive::SetRootPath() method. In this example, you would set it to c:\Program Files\. Remember about setting bFullPath argument in compression methods to false.

How to create an archive under Windows that will be readable under Linux?

Inside archives there is 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 Linux archivers cannot convert Windows attributes to Unix, so that it is needed to create the archive with the Linux attributes already (and the internal info about the system set to the Linux value). To do it, simply call the CZipArchive::SetSystemCompatibility() method with the argument set to ZipCompatibility::zcUnix.

How to extract or delete files that match a specified wildcard pattern?

You need to build a CZipIndexesArray object with the CZipArchive::FindMatches() method and then:

Why an exception is thrown when I call one of CZipArchive::CloseFile() methods?

If you haven't extracted all of the file contents (e.g. only the beginning) or you have encountered an exception during extraction, you need to call the CZipArchive::CloseFile(LPCTSTR, bool) with bAfterException parameter set to true.
Article ID: faq
Back To Top Up