COHERENT manpages
This page displays the COHERENT manpage for getchar() [Read character from standard input].
List of available manpages
Index
getchar() -- STDIO Function (libc)
Read character from standard input
#include <stdio.h>
int getchar()
getchar() reads a character from the standard input. It is equivalent to
getc(stdin).
Example
The following example gets one or more characters from the keyboard, and
echoes them on the screen.
#include <stdio.h>
main()
{
int foo;
while ((foo = getchar()) != EOF)
putchar(foo);
}
See Also
getc(),
libc,
putchar()
ANSI Standard, §7.9.7.6
POSIX Standard, §8.1
Diagnostics
getchar() returns EOF at end of file or on read error.
If you wish to receive characters from the keyboard immediately, without
waiting for the enter key, see the example in the entry for pipe().