---
name: "zip_file_set_external_attributes"
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_file_set_external_attributes"
---

# zip\_file\_set\_external\_attributes(3)

set external attributes for file in zip

## NAME

**zip\_file\_set\_external\_attributes** – set external attributes for file in zip

## LIBRARY

libzip (-lzip)

## SYNOPSIS

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

*int*\

**zip\_file\_set\_external\_attributes**(*zip\_t \*archive*, *zip\_uint64\_t index*, *zip\_flags\_t flags*, *zip\_uint8\_t opsys*, *zip\_uint32\_t attributes*);

## DESCRIPTION

The **zip\_file\_set\_external\_attributes**() function sets the operating system and external attributes for the file at position *index* in the zip archive. Currently, no *flags* are supported.

For a list of known *opsys* values, see [zip\_file\_get\_external\_attributes(3)](/zip_file_get_external_attributes/3.md).

## RETURN VALUES

Upon successful completion 0 is returned. Otherwise, -1 is returned and the error information in *archive* is set to indicate the error.

## ERRORS

**zip\_file\_set\_external\_attributes**() fails if:

- \[ZIP\_ER\_INVAL\]

  *index* is not a valid file index in *archive*.

- \[ZIP\_ER\_MEMORY\]

  Required memory could not be allocated.

- \[ZIP\_ER\_RDONLY\]

  The *archive* was opened in read-only mode.

## SEE ALSO

[libzip(3)](/libzip/3.md), [zip\_file\_get\_external\_attributes(3)](/zip_file_get_external_attributes/3.md)

## HISTORY

**zip\_file\_set\_external\_attributes**() was added in libzip 0.11.2.

## AUTHORS

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