th_read(3)

th_read3

Read and write a file header block from a tar archive

Usage

#include <libtar.h>

int th_read(TAR *t);

int th_write(TAR *t);

Version

This man page documents version 1.2 of libtar.

Overview

The th_read() function reads the next block from the tar archive associated with the TAR handle t. It then sets the current tar header associated with t to the contents of the block read.

The th_write() function writes the contents of the current tar header associated with t to the tar archive associated with t.

Return value

On successful completion, th_read() and th_write() will return 0. On failure, they will return -1 and set errno to an appropriate value.

On EOF, th_read() will return 1.

Errors

th_read() and th_write() will fail if:

EINVAL

Less than T_BLOCKSIZE blocks were read or written.

Releases

12 releases since Debian 3.0 (Woody); the text changed 2 times.

  1. 3.0
  2. 3.1–6.0
  3. 7–Arch

From libtar 1.2.20-8 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.