Adjusted points to 85
Main Topics
Browse All TopicsI managed to turn off the input buffer on the terminal so i can process one key character at a time. My question is how can i evaluate the keys (especially the arrow and function) when the user presses them and do a certain action on whatever key is pressed.
We have an AIX Unix.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
alvinrc,
Sorry I am not very conversent with unix but I think if i give u an assembly language code containing bios interrupts it should work. 'cause Whatever u're os is whatever language u use it can understand assembly bios interrupts. Paste this code in any of u're functions like this:-
_asm
{
mov ah,00h;
int 16h;
/*what these two lines will do is that they will invoke bios-interrupt 16h with function 00h which is `get a character from keyboard'
after executing these two lines u will have `ah' containing the scan code (0 or 1) depending on whether spacial character has been pressed or not and `al' will contain the ascii of your interest. You can write following instruction to validate the same
/*
mov boolean,ah;
mov character,al;
do_validation;
}
This will surely help.
regards
nadt
Business Accounts
Answer for Membership
by: nadtPosted on 2000-03-11 at 22:50:28ID: 2609009
I think this should work
int readkey(int *function_key)
{
char tempkey;
*function_key=0;
tempkey=getch();
if (tempkey==0)
{
function_key=1;
tempkey=getch();
}
return(tempkey);
}
you can cut paste this procedure in your program as-is. What this procedure essentially does is:-
1) if special key is pressed it returns its ascii number and sets *function_key=1; prompting you that a special key like arrow or esc has been pressed.
2) if normal key is pressed it returns its ascii number and sets *function_key=0; prompting you that is a normal key has been pressed.
call this function in your program as:-
int isfunct;
int xyz;
xyz=readkey(&isfunc);
hope this helps,
nadt