Takze stiahol som kniznicu ncurses.h, nejaku upravenu conio.h pre linux a uz mi funguje vacsina potrebnych funkcii, akurat kbhit() blbol, tak som vymenil za iny, ktory som nasiel na nete:
Kód:
static int initialized = 0;
static struct termios original_tty;
void kbinit()
{
struct termios tty;
tcgetattr(fileno(stdin), &original_tty);
tty = original_tty;
/* Disable ICANON line buffering, and ECHO. */
tty.c_lflag &= ~ICANON;
tty.c_lflag &= ~ECHO;
tcsetattr(fileno(stdin), TCSANOW, &tty);
/* Decouple the FILE*'s internal buffer. */
/* Rely on the OS buffer, probably 8192 bytes. */
setbuf(stdin, NULL);
initialized = 1;
}
/* Call this just before main() quits, to restore TTY settings! */
void kbfini()
{
if(initialized)
{
tcsetattr(fileno(stdin), TCSANOW, &original_tty);
initialized = 0;
}
}
int kbhit()
{
if(!initialized)
{
kbinit();
}
int bytesWaiting;
ioctl(fileno(stdin), FIONREAD, &bytesWaiting);
return bytesWaiting;
}
/* Call this just when main() does its initialization. */
/* Note: kbhit will call this if it hasn't been done yet. */
...mozno to niekomu pomoze.
Aj ked som nahradil vsetky win funkcie linuxackymi, aj tak mi to nefunguje, ako vo win...