This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Keypressed routine
- From: "Hermione Granger" <herm_oh_ninny at hotmail dot com>
- To: gcc at gnu dot org
- Date: Sat, 21 Sep 2002 06:07:53 +0100
- Subject: Keypressed routine
- Bcc:
Dear gcc people,
I'm trying to build a "keypressed routine" for linux. This is what I
have so far.
#include <sys/ioctl.h>
#include <stdio.h>
#include <iostream.h>
#define fileno(p) ((p)->fd)
bool keypressed()
/* test whether a key if pressed */
{
long l;
int aaa;
aaa = 1;
if (ioctl(aaa, FIONREAD, &l) != -1)
if (l > 0)
return true;
return false;
}
int main()
{
while (!keypressed());
{
}
return 0;
}
only problem is it only detects enters, nothing else and the stuff isn't
picked up. The pick up problem isn't much of a problem though. Please tell
me what I can do to make a keypressed routine.
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx