Synopsis Edit

#include <stdio.h>
int putchar();

Description Edit

getchar reads one character from stdin.

On success, the read character is returned. EOF is returned on end of file or if an error occurred.

Examples Edit

#include <stdio.h>

int main()
  int ch;

  while((ch=getchar())!=EOF) putchar(ch);

  return 0;

This will copy anything read from stdin to stdout

See also Edit