---
name: "zip_fread"
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_fread"
---

# zip\_fread(3)

read from file

## NAME

**zip\_fread** – read from file

## LIBRARY

libzip (-lzip)

## SYNOPSIS

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

*zip\_int64\_t*\

**zip\_fread**(*zip\_file\_t \*file*, *void \*buf*, *zip\_uint64\_t nbytes*);

## DESCRIPTION

The **zip\_fread**() function reads up to *nbytes* bytes from *file* into *buf* from the current position in the file (see [zip\_fseek(3)](/zip_fseek/3.md)). After reading, the current position is updated by the number of bytes read.

## RETURN VALUES

If successful, the number of bytes actually read is returned. When **zip\_fread**() is called after reaching the end of the file, 0 is returned. In case of error, -1 is returned.

## SEE ALSO

[libzip(3)](/libzip/3.md), [zip\_fclose(3)](/zip_fclose/3.md), [zip\_file\_get\_error(3)](/zip_file_get_error/3.md), [zip\_fopen(3)](/zip_fopen/3.md), [zip\_fseek(3)](/zip_fseek/3.md)

## HISTORY

**zip\_fread**() was added in libzip 0.6. In libzip 0.10 the return type was changed from *ssize\_t* to *zip\_int64\_t*. In libzip 0.10 the type of *nbytes* was changed from *size\_t* to *zip\_uint64\_t*.

## AUTHORS

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