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,
28                              ignoring any changes made to the file.
29
30     The zip_fopen_index() function opens the file at position index.
31
32     If encrypted data is encountered, the functions call
33     zip_fopen_encrypted(3) or zip_fopen_index_encrypted(3) respectively,
34     using the default password set with zip_set_default_password(3).
35

RETURN VALUES

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

ERRORS

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

SEE ALSO

73     libzip(3), zip_fclose(3), zip_fread(3), zip_fseek(3),
74     zip_get_num_entries(3), zip_name_locate(3), zip_set_default_password(3)
75

HISTORY

77     zip_fopen() and zip_fopen_index() were added in libzip 1.0.
78

AUTHORS

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