zip_close() function writes any changes made to archive to disk. If archive contains no files, the file is completely removed (no empty archive is written), unless the archive flag
ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVEis set. If successful, archive is freed. Otherwise archive is left unchanged and must still be freed.
To close and free a zip archive without saving changes, use zip_discard(3).
Progress updates for GUIs can be implemented using
Cancelling the write of an archive during
can be implemented using
zip_close() will fail if:
- Unexpected end-of-file found while reading from a file.
- The callback function of an added or replaced file returned an error but failed to report which.
- The path argument is
- Required memory could not be allocated.
- File is not a zip archive.
- A file read failed.
- A temporary file could not be renamed to its final name.
- A file seek failed.
- A temporary file could not be created.
- A file write failed.
- An error occurred while (de)compressing a stream with zlib(3).
zip_close() was added in libzip 0.6.
zip_close. When you open the same file again, it will be a completely new zip_t structure.