C getchar

121pages on
this wiki
Add New Page
Talk0 Share
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

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.