1ZIP_FILE_GET_COMMENT(3) BSD Library Functions Manual ZIP_FILE_GET_COMMENT(3)
2
4 zip_file_get_comment — get comment for file in zip
5
7 libzip (-lzip)
8
10 #include <zip.h>
11
12 const char *
13 zip_file_get_comment(zip_t *archive, zip_uint64_t index,
14 zip_uint32_t *lenp, zip_flags_t flags);
15
17 The zip_file_get_comment() function returns the comment for the file at
18 position index in the zip archive. The name is in UTF-8 encoding unless
19 ZIP_FL_ENC_RAW was specified (see below). This pointer should not be
20 modified or free(3)'d, and becomes invalid when archive is closed. If
21 lenp is not NULL, the integer to which it points will be set to the
22 length of the comment. If flags is set to ZIP_FL_UNCHANGED, the original
23 unchanged comment is returned.
24
25 Additionally, the following flags are supported:
26
27 ZIP_FL_ENC_RAW Return the unmodified comment as it is in the
28 ZIP archive.
29
30 ZIP_FL_ENC_GUESS (Default.) Guess the encoding of the comment
31 in the ZIP archive and convert it to UTF-8, if
32 necessary.
33
34 ZIP_FL_ENC_STRICT Follow the ZIP specification for file names
35 and extend it to file comments, expecting them
36 to be encoded in CP-437 in the ZIP archive
37 (except if it is a UTF-8 comment from the spe‐
38 cial extra field). Convert it to UTF-8.
39 Note: ASCII is a subset of both CP-437 and UTF-8.
40
42 Upon successful completion, a pointer to the comment is returned, or NULL
43 if there is no comment. In case of an error, NULL is returned and the
44 error code in archive is set to indicate the error.
45
47 zip_file_get_comment() fails if:
48
49 [ZIP_ER_INVAL] index is not a valid file index in archive.
50
52 libzip(3), zip_file_set_comment(3), zip_get_archive_comment(3)
53
55 zip_file_get_comment() was added in libzip 0.11.
56
58 Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
59
60BSD December 18, 2017 BSD