[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
getch() Get a Character from the Console without Echo
#include <conio.h> Required for declarations only
int getch(void);
getch() reads a single character from the console; the character is
not echoed. If a CONTROL-C (Ctrl-Break) is typed, the system
executes an INT 23.
Returns: The character read. There is no error return.
-------------------------------- Example ---------------------------------
The following statements prompt for a word and store it as a string
for future use. The typed characters are not echoed to the screen.
#include <conio.h>
#include <stdio.h> /* for printf */
#include <ctype.h> /* for isalpha */
int ch;
char password[8];
main()
{
int x= 0;
printf("ENTER YOUR PASSWORD: ");
while (isalpha(ch = getch()))
password[x++] = ch;
}
See Also:
cgets()
getche()
getchar()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson