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

NAME

4     zip_file_get_comment — get comment for file in zip
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

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

DESCRIPTION

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.  (Only CP-437 and UTF-8 are recog‐
33                                nized.)
34
35           ZIP_FL_ENC_STRICT    Follow the ZIP specification for file names
36                                and extend it to file comments, expecting them
37                                to be encoded in CP-437 in the ZIP archive
38                                (except if it is a UTF-8 comment from the spe‐
39                                cial extra field).  Convert it to UTF-8.
40     Note: ASCII is a subset of both CP-437 and UTF-8.
41

RETURN VALUES

43     Upon successful completion, a pointer to the comment is returned, or NULL
44     if there is no comment.  In case of an error, NULL is returned and the
45     error code in archive is set to indicate the error.
46

ERRORS

48     zip_file_get_comment() fails if:
49
50     [ZIP_ER_INVAL]     index is not a valid file index in archive.
51

SEE ALSO

53     libzip(3), zip_file_set_comment(3), zip_get_archive_comment(3)
54

HISTORY

56     zip_file_get_comment() was added in libzip 0.11.
57

AUTHORS

59     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
60
61BSD                           September 22, 2020                           BSD
Impressum