( turul16 | 2007. 09. 01., szo – 19:52 )


#include <termios.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#ifndef STDIN
#define STDIN 1
#endif
struct termios save;
int kbhit()
{
 int ret;
 ioctl(STDIN,TIOCINQ,&ret);
 retrun ret;
}

void destroy_crt() 
{
  tcsetattr(STDIN,TCSANOW,&save);
}

void initcrt()
{
	static char only=0;
	struct termios term;
	if (!only) 
        {
	   tcgetattr(STDIN,&term);
	   memcpy(&save,&term,sizeof(term));
	   term.c_lflag&=~ICANON;
	   tcsetattr(STDIN,TCSANOW,&term);
	   atexit(destroy_crt);
	   only=1;
	}
}
int  main()
{
 initcrt();
 while (!kbhit());
return 0;
}

conio.h megirtak linuxra, meg egy kis libet is hozzá ha nagyon hiányzik.