#include <fcntl.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <termios.h> #include <unistd.h> // starting from zero #define MIN 0 // 1 hr= 60 min ; 1 min= 60 sec #define MAX 60 #define MILLI 200000 int i, j, k, n, s; char c; pthread_t t1; // Function to perform operations // according keyboeard hit. int keyboardhit(void) { struct termios oldt, newt; int ch; int oldf; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); oldf = fcntl(STDIN_FILENO, F_GETFL, 0); fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); fcntl(STDIN_FILENO, F_SETFL, oldf); ...
Comments
Post a Comment