2014年1月18日 星期六

C 語言 Get 字元 API

Prototype in
  • int getch(): Get character from console, no echoing
  • int getche(): Get character form the console and echoes to screen
 Both functions no buffering of whole lines.

  •  int putch(int ch): Outputs character to the text window on the screen.
Use the current color and display attribue.
Returns ch, the character displayed.

  •   int ungetch(int ch): Push a character back to the keyboard.
The next call to getch or other console input functions will return ch.
On success, return the character ch.
On error, return value of EOF

Prototype in
  • int getchar(): Get character from stdin
On end-of-file or error, it returns EOF

  • int putchar(int ch): Outputs character on stdout
On success, puts returns the character ch.
On error, it returns EOF.