From owner-freebsd-questions@FreeBSD.ORG Tue Feb 21 11:26:24 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 04C7D16A420 for ; Tue, 21 Feb 2006 11:26:24 +0000 (GMT) (envelope-from cole@opteqint.net) Received: from elektra.opteqint.net (elektra.opteqint.net [209.25.178.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98B3D43D48 for ; Tue, 21 Feb 2006 11:26:23 +0000 (GMT) (envelope-from cole@opteqint.net) Received: from [196.47.3.46] (helo=deadmind) by elektra.opteqint.net with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.52 (FreeBSD)) id 1FBVes-000Pi9-O1 for freebsd-questions@freebsd.org; Tue, 21 Feb 2006 03:26:20 -0800 From: "Cole" To: Date: Tue, 21 Feb 2006 13:28:11 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcY22eVZwMHaGQ1/SrexzlcdgxXMDg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-Id: <20060221112623.98B3D43D48@mx1.FreeBSD.org> Subject: Programming and Input X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: cole@opteqint.net List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2006 11:26:24 -0000 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