---
name: "zip_source_zip"
section: "3"
platform: "linux"
package: "libzip"
version: "1.11.4-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/zip_source_zip"
---

# zip\_source\_zip(3)

create data source from zip file (obsolete interface)

## NAME

**zip\_source\_zip**, **zip\_source\_zip\_create** – create data source from zip file (obsolete interface)

## LIBRARY

libzip (-lzip)

## SYNOPSIS

**#include \<zip.h\>**

*zip\_source\_t* *\**\

**zip\_source\_zip**(*zip\_t \*archive*, *zip\_t \*srcarchive*, *zip\_uint64\_t srcidx*, *zip\_flags\_t flags*, *zip\_uint64\_t start*, *zip\_int64\_t len*);

*zip\_source\_t* *\**\

**zip\_source\_zip\_create**(*zip\_t \*srcarchive*, *zip\_uint64\_t srcidx*, *zip\_flags\_t flags*, *zip\_uint64\_t start*, *zip\_int64\_t len*, *zip\_error\_t \*error*);

## DESCRIPTION

The functions **zip\_source\_zip**() and **zip\_source\_zip\_create**() are the obsolete versions of [zip\_source\_zip\_file(3)](/zip_source_zip_file/3.md) or [zip\_source\_zip\_file\_create(3)](/zip_source_zip_file_create/3.md) respectively. If you want to get the compressed data of the complete file, use

```
zip_source_zip_file(za, source_archive, source_index, ZIP_FL_COMPRESSED, 0, -1, NULL)
```

The functions **zip\_source\_zip**() and **zip\_source\_zip\_create**() create a zip source from a file in a zip archive. The *srcarchive* argument is the (open) zip archive containing the source zip file at index *srcidx*. *len* bytes from offset *start* will be used in the zip\_source. If *len* is 0 or -1, the rest of the file, starting from *start*, is used. If *start* is zero and *len* is -1, the whole file will be copied without decompressing it.

Supported flags are:

- ZIP\_FL\_UNCHANGED

  Try to get the original data without any changes that may have been made to *srcarchive* after opening it.

## RETURN VALUES

Upon successful completion, the created source is returned. Otherwise, NULL is returned and the error code in *archive* or *error* is set to indicate the error.

## ERRORS

**zip\_source\_zip**() and **zip\_source\_zip\_create**() fail if:

- \[ZIP\_ER\_CHANGED\]

  Unchanged data was requested, but it is not available.

- \[ZIP\_ER\_INVAL\]

  *srcarchive*, *srcidx*, *start*, or *len* are invalid.

- \[ZIP\_ER\_MEMORY\]

  Required memory could not be allocated.

Additionally, it can return all error codes from **zip\_stat\_index**() and **zip\_fopen\_index**().

## SEE ALSO

[libzip(3)](/libzip/3.md), [zip\_file\_add(3)](/zip_file_add/3.md), [zip\_file\_replace(3)](/zip_file_replace/3.md), [zip\_source(5)](/zip_source/5.md)

## HISTORY

**zip\_source\_zip**() was added in libzip 1.0. **zip\_source\_zip\_create**() was added in libzip 1.8.0. Both were deprecated in libzip 1.10.0. Use **zip\_source\_zip\_file**() or **zip\_source\_zip\_file\_create**() instead.

## AUTHORS

Dieter Baron ⟨*dillo@nih.at*⟩ and Thomas Klausner ⟨*wiz@gatalith.at*⟩
