1ZIP_SOURCE_FILE(3) BSD Library Functions Manual ZIP_SOURCE_FILE(3)
2
4 zip_source_file, zip_source_file_create — create data source from a file
5
7 libzip (-lzip)
8
10 #include <zip.h>
11
12 zip_source_t *
13 zip_source_file(zip_t *archive, const char *fname, zip_uint64_t start,
14 zip_int64_t len);
15
16 zip_source_t *
17 zip_source_file_create(const char *fname, zip_uint64_t start,
18 zip_int64_t len, zip_error_t *error);
19
21 The functions zip_source_file() and zip_source_file_create() create a zip
22 source from a file. They open fname and read len bytes from offset start
23 from it. If len is 0 or -1, the whole file (starting from start) is
24 used.
25
26 If the file supports seek, the source can be used to open a zip archive
27 from.
28
29 The file is opened and read when the data from the source is used, usu‐
30 ally by zip_close() or zip_open_from_source().
31
33 Upon successful completion, the created source is returned. Otherwise,
34 NULL is returned and the error code in archive or error is set to indi‐
35 cate the error.
36
38 zip_source_file() and zip_source_file_create() fail if:
39
40 [ZIP_ER_INVAL] fname, start, or len are invalid.
41
42 [ZIP_ER_MEMORY] Required memory could not be allocated.
43
44 [ZIP_ER_OPEN] Opening fname failed.
45
47 libzip(3), zip_file_add(3), zip_file_replace(3), zip_source(3)
48
50 zip_source_file() and zip_source_file_create() were added in libzip 1.0.
51
53 Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
54
55BSD December 18, 2017 BSD