---
name: "zip_get_archive_flag"
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_get_archive_flag"
---

# zip\_get\_archive\_flag(3)

get status flags for zip

## NAME

**zip\_get\_archive\_flag** – get status flags for zip

## LIBRARY

libzip (-lzip)

## SYNOPSIS

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

*int*\

**zip\_get\_archive\_flag**(*zip\_t \*archive*, *zip\_flags\_t flag*, *zip\_flags\_t flags*);

## DESCRIPTION

The **zip\_get\_archive\_flag**() function returns if the flag *flag* is set for the archive *archive*. The archive flags might have been changed with **zip\_set\_archive\_flag**(); if *flags* is set to ZIP\_FL\_UNCHANGED, the original unchanged flags are tested.

Supported flags are:

- ZIP\_AFL\_CREATE\_OR\_KEEP\_FILE\_FOR\_EMPTY\_ARCHIVE

  If this flag is cleared, the archive file will be removed if the archive is empty. If it is set, an empty archive will be created, which is not recommended by the zip specification. This flag is always cleared unless explicitly set by the user with [zip\_set\_archive\_flag(3)](/zip_set_archive_flag/3.md).

- ZIP\_AFL\_IS\_TORRENTZIP

  The archive is in torrentzip format.

- ZIP\_AFL\_RDONLY

  The archive is read-only.

- ZIP\_AFL\_WANT\_TORRENTZIP

  If the flag is set, the archive will be written in torrentzip format. This flag is always cleared unless explicitly set by the user with [zip\_set\_archive\_flag(3)](/zip_set_archive_flag/3.md).

## RETURN VALUES

**zip\_get\_archive\_flag**() returns 1 if *flag* is set for *archive*, 0 if not, and -1 if an error occurred.

## SEE ALSO

[libzip(3)](/libzip/3.md), [zip\_set\_archive\_flag(3)](/zip_set_archive_flag/3.md)

## HISTORY

**zip\_get\_archive\_flag**() was added in libzip 0.9. In libzip 0.11 the type of *flag* was changed from *int* to *zip\_flags\_t* *m* and the type of *flags* was changed from *int* to *zip\_flags\_t*. ZIP\_AFL\_CREATE\_OR\_KEEP\_FILE\_FOR\_EMPTY\_ARCHIVE, ZIP\_AFL\_IS\_TORRENTZIP, and ZIP\_AFL\_WANT\_TORRENTZIP were added in libzip 1.10.0.

## AUTHORS

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