1ZIP_GET_NAME(3) BSD Library Functions Manual ZIP_GET_NAME(3)
2
4 zip_get_name — get name of file by index
5
7 libzip (-lzip)
8
10 #include <zip.h>
11
12 const char *
13 zip_get_name(zip_t *archive, zip_uint64_t index, zip_flags_t flags);
14
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.
32
33 ZIP_FL_ENC_STRICT Follow the ZIP specification and expect CP-437
34 encoded names in the ZIP archive (except if
35 they are explicitly marked as UTF-8). Convert
36 it to UTF-8.
37 Note: ASCII is a subset of both CP-437 and UTF-8.
38
40 Upon successful completion, a pointer to the name is returned. Other‐
41 wise, NULL and the error code in archive is set to indicate the error.
42
44 zip_get_name() fails if:
45
46 [ZIP_ER_DELETED] index refers to a file that has been deleted (see
47 zip_delete(3)).
48
49 [ZIP_ER_INVAL] index is not a valid file index in archive, or index
50 points to an added file and ZIP_FL_UNCHANGED is set.
51
52 [ZIP_ER_MEMORY] Required memory could not be allocated.
53
55 libzip(3), zip_name_locate(3)
56
58 zip_get_name() was added in libzip 0.6. In libzip 0.10 the type of index
59 was changed from int to zip_uint64_t. In libzip 0.11 the type of flags
60 was changed from int to zip_flags_t.
61
63 Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
64
65BSD December 18, 2017 BSD