Problem with keyboard input routine
Posted: Sun Jul 17, 2005 4:40 pm
Heres the code for it:
As you can see it should return the last charecter the user inputs.
buf is the buffer the charecter is stored in, kbdus is a list of charecter values, curkey is the current scancode value and rkey is 1 if the return key is pressed. But it just seems to return nothing, and I don't know why? Any ideas? its probably a really stupid mistake....
cheers
Jonny
Code: Select all
unsigned char kin(){
unsigned char buf;
rkey = 0;
buf = "";
while(rkey == 0){
if(curkey > 0){
buf = kbdus[curkey];
puts("");
}
}
return buf;
}
buf is the buffer the charecter is stored in, kbdus is a list of charecter values, curkey is the current scancode value and rkey is 1 if the return key is pressed. But it just seems to return nothing, and I don't know why? Any ideas? its probably a really stupid mistake....
cheers
Jonny