int  getchar ( void );

Get the next character from stdin.
  Returns the next character from the standard input (stdin).
  It corresponds to: getc(stdin)



Return Value.
  The character read is returned as int. If the End Of File is reached or there has been an error reading, the function returns an EOF character.
  EOF can also indicate an error while reading, use ferror() to check if an error has occurred.

  Defined in ANSI-C.


/* getchar example : typewriter */
#include <stdio.h>

main ()
  char c;
  puts ("Enter text. Include a dot ('.') in a sentence to exit:");
  do {
    putchar (c);
  } while (c != '.');
  return 0;
  A simple typewriter. Every sentence is echoed once ENTER has been pressed until a dot (.) is included in the text.

See also.
  getc, putchar, fgetc, fopen

© The C++ Resources Network, 2000