mirror of
https://github.com/n05la3/cmdtypist
synced 2024-11-17 09:25:36 +00:00
mikmiked getche() of conio.h
This commit is contained in:
parent
ea636383ae
commit
a89100c839
@ -189,6 +189,21 @@ void get_only_char(char *n)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*prevent echoing of characters from the buffer*/
|
||||||
|
extern int getche(void)
|
||||||
|
{
|
||||||
|
struct termios oldattr, newattr;
|
||||||
|
int ch;
|
||||||
|
tcgetattr( STDIN_FILENO, &oldattr );
|
||||||
|
newattr = oldattr;
|
||||||
|
newattr.c_lflag &= ~( ICANON | ECHO);//shell out to kill echo
|
||||||
|
tcsetattr( STDIN_FILENO, TCSANOW, &newattr );
|
||||||
|
system("stty echo");//shell out to kill echo
|
||||||
|
ch = getchar();
|
||||||
|
tcsetattr( STDIN_FILENO, TCSANOW, &oldattr );
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
|
||||||
void edit_name(void)
|
void edit_name(void)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
Loading…
Reference in New Issue
Block a user