---
name: "pack_fread"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pack_fread/3alleg4"
---

# pack\_fread(3alleg4)

Reads n bytes from the stream. Allegro game programming library.

## NAME

pack\_fread - Reads n bytes from the stream. Allegro game programming library.

## SYNOPSIS

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

**long pack\_fread(void \*p, long n, PACKFILE \*f);**

## DESCRIPTION

Reads \`n' bytes from the stream \`f', storing them at the memory location pointed to by \`p'. Example:

```
   unsigned char buf[256];
   ...
   if (pack_fread(buf, 256, input_file) != 256)
      abort_on_error("Truncated input file!");
```

## RETURN VALUE

Returns the number of bytes read, which will be less than \`n' if EOF is reached or an error occurs. Error codes are stored in errno.

## SEE ALSO

**pack\_fopen**(3alleg4), **pack\_fopen\_chunk**(3alleg4), **pack\_feof**(3alleg4), **expackf**(3alleg4)
