www.LinuxHowtos.org
ZIP_CLOSE
Section: C Library Functions (3)Index Return to Main Contents
BSD mandoc
NAME
zip_close - close zip archiveLIBRARY
libzip -lzip)SYNOPSIS
In zip.h Ft int Fn zip_close zip_t *archiveDESCRIPTION
The Fn 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_discard3.
Progress updates for GUIs can be implemented using zip_register_progress_callback_with_state3. Cancelling the write of an archive during can be implemented using zip_register_cancel_callback_with_state3.
RETURN VALUES
Upon successful completion 0 is returned. Otherwise, -1 is returned and the error code in archive is set to indicate the error.ERRORS
Fn zip_close will fail if:- Bq Er ZIP_ER_EOF
- Unexpected en-o-file found while reading from a file.
- Bq Er ZIP_ER_INTERNAL
- The callback function of an added or replaced file returned an error but failed to report which.
- Bq Er ZIP_ER_INVAL
- The path argument is NULL
- Bq Er ZIP_ER_MEMORY
- Required memory could not be allocated.
- Bq Er ZIP_ER_NOZIP
- File is not a zip archive.
- Bq Er ZIP_ER_READ
- A file read failed.
- Bq Er ZIP_ER_RENAME
- A temporary file could not be renamed to its final name.
- Bq Er ZIP_ER_SEEK
- A file seek failed.
- Bq Er ZIP_ER_TMPOPEN
- A temporary file could not be created.
- Bq Er ZIP_ER_WRITE
- A file write failed.
- Bq Er ZIP_ER_ZLIB
- An error occurred while (de)compressing a stream with zlib(3).
Additionally, any errors returned by the callback function for added or replaced files will be passed back.
SEE ALSO
libzip(3), zip_discard3, zip_fdopen3, zip_get_error3, zip_open3, zip_register_cancel_callback_with_state3, zip_register_progress_callback_with_state3, zip_set_archive_flag3, zip_strerror3HISTORY
Fn zip_close was added in libzip 0.6.AUTHORS
An -nosplit An Dieter Baron Aq Mt dillo@nih.at and An Thomas Klausner Aq Mt wiz@gatalith.atCAVEATS
Please note that all indices, zip_stat3 information and other data about the archive is invalid after . When you open the same file again, it will be a completely new Vt zip_t structure.