getc(3)

getc3

Get character from stream

Usage

#include <stdio.h>

int getc(FILE *stream);

Library

Standard C library (libc, -lc)

Overview

getc() is equivalent to fgetc(3), except for the BUGS (see below).

Use fgetc(3) instead.

Releases

19 releases since Debian 1.1 (Buzz); the text changed 15 times.

  1. 1.1–1.2
  2. 1.3–2.1
  3. 2.2
  4. 3.0
  5. 3.1
  6. 4.0
  7. 5.0
  8. 6.0
  9. 7
  10. 8
  11. 9
  12. 10
  13. 11
  14. 12
  15. 13
  16. Arch

Standards

C23, POSIX.1-2024.

History

POSIX.1-2001, C89.

Bugs

Multiple evaluation

It may be implemented as a macro, and it may evaluate stream more than once.

Name

The name is inconsistent. It is often confused with getchar(3), as normally <stdio.h> functions without the "f" prefix in their name are variants that use stdin.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.