This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Keypressed routine


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]