| ZIP_CLOSE(3) | Library Functions Manual | ZIP_CLOSE(3) |
zip_close — close
zip archive
libzip (-lzip)
#include
<zip.h>
int
zip_close(zip_t
*archive);
The
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_ARCHIVE is
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
zip_register_progress_callback_with_state(3).
Cancelling the write of an archive during zip_close
can be implemented using
zip_register_cancel_callback_with_state(3).
Upon successful completion 0 is returned. Otherwise, -1 is returned and the error code in archive is set to indicate the error.
zip_close() will fail if:
ZIP_ER_EOF]ZIP_ER_INTERNAL]ZIP_ER_INVAL]NULL.ZIP_ER_MEMORY]ZIP_ER_NOZIP]ZIP_ER_READ]ZIP_ER_RENAME]ZIP_ER_SEEK]ZIP_ER_TMPOPEN]ZIP_ER_WRITE]ZIP_ER_ZLIB]libzip(3), zip_discard(3), zip_fdopen(3), zip_get_error(3), zip_open(3), zip_register_cancel_callback_with_state(3), zip_register_progress_callback_with_state(3), zip_set_archive_flag(3), zip_strerror(3)
zip_close() was added in libzip 0.6.
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at>
Please note that all indices,
zip_stat(3) information and other
data about the archive is invalid after zip_close.
When you open the same file again, it will be a completely new
zip_t structure.
| January 23, 2023 | NiH |