Mail Archives: djgpp/1993/05/07/11:00:40
I had a similar problem (was looking for an unbuffered get-character
function. Up to now I'm using getkey() of <pc.h> but
it has the drawback of mapping key combinations to values greater
than 255. So I wrote a wrapper that maps values above 255
to character (<256) combinations:
int getkbd()
{
static int i_next=-1;
int i;
if (i_next != -1)
{
i=i_next;
i_next=-1;
}
else
{
i=getkey();
if (i>511)
{
i_next=i-512;
i=27;
}
if (i>255)
{
i_next=i-256;
i=0;
}
}
return(i);
}
I'm not as happy with that solution as I should be.
I there a better solution?
Uwe
--
-------------------------------------------------------------------
Uwe Huebner e-mail: huebner AT borneo DOT gmd DOT de
GMD/SET
P.O.Box 1316 Phone: (+49) 2241 14-2771
D-5205 Sankt Augustin 1 Fax: (+49) 2241 14-2342
-------------------------------------------------------------------
- Raw text -