zip_fopen
,
zip_fopen_index
— open file
in zip archive for reading
#include
<zip.h>
zip_file_t *
zip_fopen
(zip_t
*archive, const char
*fname, zip_flags_t
flags);
zip_file_t *
zip_fopen_index
(zip_t
*archive, zip_uint64_t
index, zip_flags_t
flags);
Upon successful completion, a struct
zip_file pointer is returned. Otherwise, NULL
is returned and the error code in archive is set to
indicate the error.
- [
ZIP_ER_CHANGED
]
- The file data has been changed and the data source does not support
rereading data.
- [
ZIP_ER_COMPNOTSUPP
]
- The compression method used is not supported.
- [
ZIP_ER_ENCRNOTSUPP
]
- The encryption method used is not supported.
- [
ZIP_ER_MEMORY
]
- Required memory could not be allocated.
- [
ZIP_ER_NOPASSWD
]
- The file is encrypted, but no password has been provided.
- [
ZIP_ER_READ
]
- A file read error occurred.
- [
ZIP_ER_SEEK
]
- A file seek error occurred.
- [
ZIP_ER_WRONGPASSWD
]
- The provided password does not match the password used for encryption.
Note that some incorrect passwords are not detected by the check done by
zip_fopen
().
- [
ZIP_ER_ZLIB
]
- Initializing the zlib stream failed.
The function zip_fopen
() may also fail and
set zip_err for any of the errors specified for the
routine
zip_name_locate(3).
The function zip_fopen_index
() may also
fail with ZIP_ER_INVAL
if
index is invalid.
zip_fopen
() and
zip_fopen_index
() were added in libzip 1.0.