Programming and Input

Cole cole at
Tue Feb 21 03:26:24 PST 2006


Im trying to write a program that can read the Function keys, namely like F1, and F2, and so on. Im
trying to do this using C. 

I just wanted to know exactly how to get it right. I know that you need to actually search for 2
values. Say for instance I want to read, F1, I know we need to first check the value to see if its
equal to 27, and then the second value to see if its equal to 65. Also do I need to set stdin to be
unbuffered for this?

Also which function should i be using for this? Can i do something like this or am i totally

int i = 0;
 i = getc(stdin);
 if(i == 27){
    printf("we found first part\n");
Now, from here how do I procede? If this is correct at all? Cause if I try to use getc to read
again, I do not get 65, or any other value.

So im asking exactly how would one go about reading in the F* keys from a C program?

Please cc a copy to me since im not currently subscribed to this list.


More information about the freebsd-questions mailing list