Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Feb 2006 13:28:11 +0200
From:      "Cole" <cole@opteqint.net>
To:        <freebsd-questions@freebsd.org>
Subject:   Programming and Input
Message-ID:  <20060221112623.98B3D43D48@mx1.FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hi.

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
confused?

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.

Thanks
/Cole




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060221112623.98B3D43D48>