get a character from stdin
#include <stdio.h> int getchar( void );
The getchar() function is equivalent to getc() with the argument stdin.
The getchar() function returns the next character from the input stream pointed to by stdin. If the stream is at end-of-file, the end-of-file indicator is set, and getchar() returns EOF. If a read error occurs, the error indicator is set, and getchar() returns EOF. When an error has occurred, errno contains a value that indicates the type of error that has been detected.
errno, fgetc(), fgetchar(), getc()
#include <stdio.h> void main() { FILE *fp; int c; fp = freopen( "file", "r", stdin ); while( (c = getchar()) != EOF ) putchar(c); fclose( fp ); }
ANSI
All (except DOS/PM)