The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help with return codes ammu Shell Programming and Scripting 2 02-04-2008 11:57 AM
LCD codes on a P570 johnf AIX 5 11-07-2006 07:00 PM
Return Codes kris01752 UNIX for Advanced & Expert Users 3 09-25-2006 09:40 AM
Know any good codes? fgjiu UNIX for Advanced & Expert Users 2 03-07-2006 02:33 PM
exit codes donna carter High Level Programming 3 05-31-2001 06:35 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-19-2001
Registered User
 

Join Date: Oct 2001
Location: India
Posts: 45
Question How to get Key codes

Hi Experts,
I like to get the Key codes of the keys in the Keyboard while I press it.
Its something like scan code.
I want to know which key had been pressed.

Can anyone fine me a solution for this using C.

Regards
Anent
Reply With Quote
Forum Sponsor
  #2  
Old 11-19-2001
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Look for a program named 'xev' or one named 'showkey' as examples.
Reply With Quote
  #3  
Old 11-19-2001
Registered User
 

Join Date: Oct 2001
Location: India
Posts: 45
PxT,
where can I find these examples.
i searched around various directories in my harddisk. but no result.

Anent
Reply With Quote
  #4  
Old 11-19-2001
shaik786
Guest
 

Posts: n/a
Hi!

If you are planning to implement the code in a C program, you can use the CURSES.H library, or the TERMIO.H library

Rgds
SHAIK
Reply With Quote
  #5  
Old 11-20-2001
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Xev: http://ftp.xfree86.org/pub/X.Org/pub.../programs/xev/
Reply With Quote
  #6  
Old 12-14-2001
Registered User
 

Join Date: Oct 2001
Location: India
Posts: 45
Thanks for u all,
Can anyone get me a C code for the above operation.

Thanks in Advance.
Anent
Reply With Quote
  #7  
Old 12-14-2001
shaik786
Guest
 

Posts: n/a
#include < stdio.h >
#include < curses.h >

main()
{
int ch;

initscr();
ch = getch();
endwin();

printf(" %d\n", ch);
}

If you are not familier with CURSES.H library, refer the man pages on the same to learn more of it. The above is the simplest of programs presented.

Rgds
SHAIK
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0