Programmer's Wiki
This page has been moved to the Programmer's Wiki.
Please do not make any changes or additions to this page.

Any modifications, if still appropriate, should be made on C getchar at the Programmer's Wiki.

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