adding a kbhit() function

This commit is contained in:
phyto
2019-05-13 17:48:58 +02:00
parent cce90eb60e
commit 06b5603b8b
3 changed files with 36 additions and 2 deletions

12
essai.c
View File

@@ -19,7 +19,7 @@ int verbosity;
/* --------------------------------------------------------------- */
int affiche_valeurs(int sfd, int nbloops)
{
int idx, foo;
int idx, foo, key;
char ligne[200];
int Idatas[4];
float Fdatas[4];
@@ -38,8 +38,16 @@ if (NULL==fp) {
for (idx=0; idx<nbloops; idx++) {
if (kbhit()) {
message("!!! KEY !!!");
sleep(2);
}
foo = getline_to(sfd, ligne, 100, 0);
if (verbosity) message(ligne);
if (*ligne == 'M') {
message(ligne);
}
#if DEBUG_LEVEL
if (foo) fprintf(stderr, "get values -> %d\n", foo);