---
name: "zip_source_filep"
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_filep"
---

# zip\_source\_filep(3)

create data source from FILE \*

## NAME

**zip\_source\_filep**, **zip\_source\_filep\_create** – create data source from FILE \*

## LIBRARY

libzip (-lzip)

## SYNOPSIS

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

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

**zip\_source\_filep**(*zip\_t \*archive*, *FILE \*file*, *zip\_uint64\_t start*, *zip\_int64\_t len*);

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

**zip\_source\_filep\_create**(*FILE \*file*, *zip\_uint64\_t start*, *zip\_int64\_t len*, *zip\_error\_t \*error*);

## DESCRIPTION

The functions **zip\_source\_filep**() and **zip\_source\_filep\_create**() create a zip source from a file stream. They read *len* bytes from offset *start* from the open file stream *file*. For a description of the *len* argument, see [zip\_source\_file(3)](/zip_source_file/3.md).

If the file stream supports seeking, the source can be used to open a read-only zip archive from.

The file stream is closed when the source is being freed, usually by [zip\_close(3)](/zip_close/3.md).

## 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\_filep**() fails if:

- \[ZIP\_ER\_INVAL\]

  *file*, *start*, or *len* are invalid.

- \[ZIP\_ER\_MEMORY\]

  Required memory could not be allocated.

## 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), [zip\_source\_file(3)](/zip_source_file/3.md)

## HISTORY

**zip\_source\_filep**() and **zip\_source\_filep\_create**() were added in libzip 1.0.

ZIP\_LENGTH\_TO\_END and ZIP\_LENGTH\_UNCHECKED were added in libzip 1.10.1.

## AUTHORS

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