---
name: "archive_write_header"
section: "3"
platform: "linux"
package: "libarchive"
version: "3.8.11-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/archive_write_header"
---

# archive\_write\_header(3)

functions for creating archives

## NAME

**archive\_write\_header** – functions for creating archives

## LIBRARY

Streaming Archive Library (libarchive, -larchive)

## SYNOPSIS

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

*int*\

**archive\_write\_header**(*struct archive \**, *struct archive\_entry \**);

## DESCRIPTION

Build and write a header using the data in the provided struct archive\_entry structure. See [archive\_entry(3)](/archive_entry/3.md) for information on creating and populating struct archive\_entry objects.

## RETURN VALUES

This function returns **ARCHIVE\_OK** on success, or one of the following on error: **ARCHIVE\_RETRY** for operations that might succeed if retried, **ARCHIVE\_WARN** for unusual conditions that do not prevent further operations, and **ARCHIVE\_FATAL** for serious errors that make remaining operations impossible.

## ERRORS

Detailed error codes and textual descriptions are available from the **archive\_errno**() and **archive\_error\_string**() functions.

## SEE ALSO

[tar(1)](/tar/1.md), [archive\_write\_set\_options(3)](/archive_write_set_options/3.md), [libarchive(3)](/libarchive/3.md), [cpio(5)](/cpio/5.md), [mtree(5)](/mtree/5.md), [tar(5)](/tar/5.md)
