---
name: "pack_ungetc"
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_ungetc/3alleg4"
---

# pack\_ungetc(3alleg4)

Moves one single character back to the input buffer. Allegro game programming library.

## NAME

pack\_ungetc - Moves one single character back to the input buffer. Allegro game programming library.

## SYNOPSIS

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

**int pack\_ungetc(int c, PACKFILE \*f);**

## DESCRIPTION

Puts a character back to the file's input buffer. Like with ungetc from libc, only a single push back is guaranteed.

Note: pack\_fgets internally uses pack\_ungetc, so never use pack\_ungetc directly after using pack\_fgets on a PACKFILE.

## RETURN VALUE

Returns c on success, or EOF on error.

## SEE ALSO

**pack\_getc**(3alleg4), **pack\_fgets**(3alleg4)
