1ZIP_FOPEN(3)             BSD Library Functions Manual             ZIP_FOPEN(3)
2

NAME

4     zip_fopen, zip_fopen_index — open file in zip archive for reading
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

10     #include <zip.h>
11
12     zip_file_t *
13     zip_fopen(zip_t *archive, const char *fname, zip_flags_t flags);
14
15     zip_file_t *
16     zip_fopen_index(zip_t *archive, zip_uint64_t index, zip_flags_t flags);
17

DESCRIPTION

19     The zip_fopen() function opens the file name fname in archive.  The flags
20     argument specifies how the name lookup should be done, according to the
21     values are described in zip_name_locate(3).  Also, the following values
22     may be or'ed to it.
23
24           ZIP_FL_COMPRESSED  Read the compressed data.  Otherwise the data is
25                              uncompressed by zip_fread().
26
27           ZIP_FL_UNCHANGED   Read the original data from the zip archive, ig‐
28                              noring any changes made to the file; this is not
29                              supported by all data sources.
30
31     The zip_fopen_index() function opens the file at position index.
32
33     If encrypted data is encountered, the functions call
34     zip_fopen_encrypted(3) or zip_fopen_index_encrypted(3) respectively, us‐
35     ing the default password set with zip_set_default_password(3).
36

RETURN VALUES

38     Upon successful completion, a struct zip_file pointer is returned.  Oth‐
39     erwise, NULL is returned and the error code in archive is set to indicate
40     the error.
41

ERRORS

43     [ZIP_ER_CHANGED]   The file data has been changed and the data source
44                        does not support rereading data.
45
46     [ZIP_ER_COMPNOTSUPP]
47                        The compression method used is not supported.
48
49     [ZIP_ER_ENCRNOTSUPP]
50                        The encryption method used is not supported.
51
52     [ZIP_ER_MEMORY]    Required memory could not be allocated.
53
54     [ZIP_ER_NOPASSWD]  The file is encrypted, but no password has been pro‐
55                        vided.
56
57     [ZIP_ER_READ]      A file read error occurred.
58
59     [ZIP_ER_SEEK]      A file seek error occurred.
60
61     [ZIP_ER_WRONGPASSWD]
62                        The provided password does not match the password used
63                        for encryption.  Note that some incorrect passwords
64                        are not detected by the check done by zip_fopen().
65
66     [ZIP_ER_ZLIB]      Initializing the zlib stream failed.
67
68     The function zip_fopen() may also fail and set zip_err for any of the er‐
69     rors specified for the routine zip_name_locate(3).
70
71     The function zip_fopen_index() may also fail with ZIP_ER_INVAL if index
72     is invalid.
73

SEE ALSO

75     libzip(3), zip_fclose(3), zip_fread(3), zip_fseek(3),
76     zip_get_num_entries(3), zip_name_locate(3), zip_set_default_password(3)
77

HISTORY

79     zip_fopen() and zip_fopen_index() were added in libzip 1.0.
80

AUTHORS

82     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
83
84BSD                            December 18, 2017                           BSD
Impressum