getc - Man Page

get character from stream

Library

Standard C library (libc, -lc)

Synopsis

#include <stdio.h>

int getc(FILE *stream);

Description

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

Use fgetc(3) instead.

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.

See Also

fgetc(3)

Info

2025-10-10 Linux man-pages 6.20