chore: изменения в коде шаблона

This commit is contained in:
root
2024-09-13 00:08:49 +03:00
parent a5a36086b0
commit 6c9d810c6e
2 changed files with 76 additions and 53 deletions

View File

@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <time.h>
/* Use this variable to remember original terminal attributes. */
@ -32,7 +33,8 @@ void set_input_mode()
/* Set the funny terminal modes. */
tcgetattr (STDIN_FILENO, &tattr);
tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */
tattr.c_cc[VMIN] = 1;
tattr.c_cc[VMIN] = 0;
tattr.c_cc[VTIME] = 0;
tcsetattr (STDIN_FILENO, TCSAFLUSH, &tattr);
}
@ -52,10 +54,10 @@ char isKeyPressed()
return 0;
}
//int main()
//{
// set_input_mode();
// while (isKeyPressed() == 0) {}
// printf("ok");
// reset_input_mode();
//}
int main()
{
set_input_mode();
while (isKeyPressed() == 0) {printf("hell\n");}
printf("ok\n");
reset_input_mode();
}