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

NAME

4     zip_get_name — get name of file by index
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

10     #include <zip.h>
11
12     const char *
13     zip_get_name(zip_t *archive, zip_uint64_t index, zip_flags_t flags);
14

DESCRIPTION

16     The zip_get_name() function returns the name of the file at position
17     index in archive.  The name is in UTF-8 encoding unless ZIP_FL_ENC_RAW
18     was specified (see below).
19
20     If flags is set to ZIP_FL_UNCHANGED, the original unchanged filename is
21     returned.  The returned string must not be modified or freed, and becomes
22     invalid when archive is closed.
23
24     Additionally, the following flags are supported:
25
26           ZIP_FL_ENC_RAW       Return the unmodified names as it is in the
27                                ZIP archive.
28
29           ZIP_FL_ENC_GUESS     (Default.)  Guess the encoding of the name in
30                                the ZIP archive and convert it to UTF-8, if
31                                necessary.  (Only CP-437 and UTF-8 are recog‐
32                                nized.)
33
34           ZIP_FL_ENC_STRICT    Follow the ZIP specification and expect CP-437
35                                encoded names in the ZIP archive (except if
36                                they are explicitly marked as UTF-8).  Convert
37                                it to UTF-8.
38     Note: ASCII is a subset of both CP-437 and UTF-8.
39

RETURN VALUES

41     Upon successful completion, a pointer to the name is returned.  Other‐
42     wise, NULL and the error code in archive is set to indicate the error.
43

ERRORS

45     zip_get_name() fails if:
46
47     [ZIP_ER_DELETED]   index refers to a file that has been deleted (see
48                        zip_delete(3)).
49
50     [ZIP_ER_INVAL]     index is not a valid file index in archive, or index
51                        points to an added file and ZIP_FL_UNCHANGED is set.
52
53     [ZIP_ER_MEMORY]    Required memory could not be allocated.
54

SEE ALSO

56     libzip(3), zip_name_locate(3)
57

HISTORY

59     zip_get_name() was added in libzip 0.6.  In libzip 0.10 the type of index
60     was changed from int to zip_uint64_t.  In libzip 0.11 the type of flags
61     was changed from int to zip_flags_t.
62

AUTHORS

64     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
65
66BSD                           September 22, 2020                           BSD
Impressum