Visit Our UNIX and Linux User Community


How to get Key codes


 
Thread Tools Search this Thread
Top Forums Programming How to get Key codes
# 1  
Old 11-19-2001
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
# 2  
Old 11-19-2001
Look for a program named 'xev' or one named 'showkey' as examples.
# 3  
Old 11-19-2001
PxT,
where can I find these examples.
i searched around various directories in my harddisk. but no result.

Anent
# 4  
Old 11-20-2001
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
shaik786
# 5  
Old 11-20-2001
# 6  
Old 12-14-2001
Thanks for u all,
Can anyone get me a C code for the above operation.

Thanks in Advance.
Anent
# 7  
Old 12-14-2001
#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
shaik786

Previous Thread | Next Thread
Test Your Knowledge in Computers #189
Difficulty: Easy
The boolean data type in Python is immutable.
True or False?

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script @ Find a key word and If the key word matches then replace next 7 lines only

Hi All, I have a XML file which is looks like as below. <<please see the attachment >> <?xml version="1.0" encoding="UTF-8"?> <esites> <esite> <name>XXX.com</name> <storeId>10001</storeId> <module> ... (4 Replies)
Discussion started by: Rajeev_hbk
4 Replies

2. Solaris

Solaris 8 ssh public key authentication issue - Server refused our key

Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks. ... (1 Reply)
Discussion started by: aixlover
1 Replies

3. AIX

Warning codes

Dear Experts, i am very to AIX when i am trying to compile my code i am getting two warning several times like 1540-0053 (W) The declaration of a class member within the class definition must not be qualified. "/usr/include/alloca.h", line 34.9: 1540-1401 (I) An unknown "pragma __alloca" is... (1 Reply)
Discussion started by: vin_pll
1 Replies

4. UNIX for Dummies Questions & Answers

Pressing backspace key simulates enter key

Hi, Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused: Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies

5. UNIX for Advanced & Expert Users

Return Codes

I have a simple script which renames a file.How do i capture the return code of the script if the script fails (3 Replies)
Discussion started by: kris01752
3 Replies

6. Cybersecurity

SSH key code versus server key code

Hi, When logging in using SSH access (to a remotely hosted account), I received a prompt to accept a server's key fingerprint. Wrote that string of code down for comparision. Already emailed my host for their listing of the string of code for the server's key fingerprint (for comparison,... (1 Reply)
Discussion started by: Texan
1 Replies

7. UNIX for Dummies Questions & Answers

Help with Return codes

I have the below script I am running on a Solaris system to check the status of a Tivoli Workload Scheduler job and return the status. We need this script to return a '0' if any of the jobs in the stream are in a "EXEC" state and an "1" if in a "HOLD" state. I am not a programmer so I am not sure... (1 Reply)
Discussion started by: leezer1204
1 Replies

8. Programming

exit codes

Where can a locate a list of Unix exit codes? thank you, Donna (3 Replies)
Discussion started by: donna carter
3 Replies

Featured Tech Videos