ok questo è il mio output
su redhat 9.0 (mezza rotta : )
/tmp/ccIfID0B.o(.text+0x64): In function `main':
: undefined reference to `kbhit'
collect2: ld returned 1 exit status
la funzione main l'ho modificata includendo un valore int
di ritorno senno mi dava altri errori.
sembra comunque che la funzione kbhit non si trovi nel compilatore gcc.
se ti puo essere d'aiuto ho trovato una specie di wrapper
a questa funzione per linux
con questa si riesce a compilare senza prob
ciao
Codice PHP:
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
/*
* kbhit() -- a keyboard lookahead monitor
*
* returns the number of characters available to read.
*/
int
kbhit(void)
{
int cnt = 0;
int error;
static struct termios Otty, Ntty;
tcgetattr(0, &Otty);
Ntty = Otty;
Ntty.c_iflag = 0; /* input mode */
Ntty.c_oflag = 0; /* output mode */
Ntty.c_lflag &= ~ICANON; /* raw mode */
Ntty.c_cc[VMIN] = CMIN; /* minimum time to wait */
Ntty.c_cc[VTIME] = CTIME; /* minimum char's to wait for */
if (0 == (error = tcsetattr(0, TCSANOW, &Ntty))) {
struct timeval tv;
error += ioctl(0, FIONREAD, &cnt);
error += tcsetattr(0, TCSANOW, &Otty);
tv.tv_sec = 0;
tv.tv_usec = 100;
/* a slight time delay is required for tight loops */
select(1, NULL, NULL, NULL, &tv);
}
return (error == 0 ? cnt : -1 );
}