---
name: "archive_read_next_header"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/archive_read_header"
---

# archive\_read\_next\_header(3)

functions for reading streaming archives

Part of [archive\_read\_header(3)](/archive_read_header/3.md).

## NAME

**archive\_read\_next\_header**, **archive\_read\_next\_header2** – functions for reading streaming archives

## LIBRARY

Streaming Archive Library (libarchive, -larchive)

## SYNOPSIS

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

*int*\

**archive\_read\_next\_header**(*struct archive \**, *struct archive\_entry \*\**);

*int*\

**archive\_read\_next\_header2**(*struct archive \**, *struct archive\_entry \**);

## DESCRIPTION

- **archive\_read\_next\_header**()

  Read the header for the next entry and return a pointer to a struct archive\_entry. This is a convenience wrapper around **archive\_read\_next\_header2**() that reuses an internal struct archive\_entry object for each request.

- **archive\_read\_next\_header2**()

  Read the header for the next entry and populate the provided struct archive\_entry.

## RETURN VALUES

These functions return **ARCHIVE\_OK** (the operation succeeded), **ARCHIVE\_WARN** (the operation succeeded but a non-critical error was encountered), **ARCHIVE\_EOF** (end-of-archive was encountered), **ARCHIVE\_RETRY** (the operation failed but can be retried), and **ARCHIVE\_FATAL** (there was a fatal error; the archive should be closed immediately).

## 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\_read(3)](/archive_read/3.md), [archive\_read\_data(3)](/archive_read_data/3.md), [archive\_read\_extract(3)](/archive_read_extract/3.md), [archive\_read\_filter(3)](/archive_read_filter/3.md), [archive\_read\_format(3)](/archive_read_format/3.md), [archive\_read\_open(3)](/archive_read_open/3.md), [archive\_read\_set\_options(3)](/archive_read_set_options/3.md), [archive\_util(3)](/archive_util/3.md), [libarchive(3)](/libarchive/3.md), [tar(5)](/tar/5.md)
