Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi everyone again :-)
I am writing a database program in C and I need to program the keyboard but I have don almost everything except program/set the keyboard. Can anyone tell me where I can find this out or just show me how to do this? (PLEASE NO ASM or other language just pure C). Thank you very much!!
Thank you!
Alexander

The obvious questions are
1) Do you mean music keyboard or console keyboard?
2) If it is a music keyboard, is it communicating through a MIDI interface or one of the COM ports or something else?
3) Which OS are you using?

Thank you cup,
I am using a console keyboard and I am using MS/DR-DOS, Windows NT/98. My program will run in dos thue.Thank you!
Alexander :-)

Do you mean you want capture the user pressing the F-keys and action them accordngly or any key at all.
The F-keys and numeric keyboard in non-numeric mode are encoded. They return a sequence of characters. All you need to do is write a simple program with getch and output the value in hex. Then press the keys you are interested in and it will tell you what the sequence is.
If you want something else like knowing whether the user has pressed the left shift or the right shift, you need to examine the keyboard decoding matrix. That is in one of the software interrupts. It is a RAS/CAS mechanism and the grid has a strange mapping.

Since you are simply indicating 'C' I have to ask what compiler/version. If you are using something like Turbo C 3.0 then you have the OOP extensions that most DOS based C++ compilers offer for example.
Anyways, checking the keyboard buffer with keypressed (retuns a boolean value) will tell you if the keyboard buffer has anything in it. readkey/getkey (depending on complier/versions etc.) will allow you to read a char* from the keyboard and then you can compare for the value zero to determine if it is an extended key that was pressed and evaluate the next value to determine what key that was otherwise it is a printable character between the ascii values of 32 and 128. Clarify the programming language specs and we may be able to be more helpfull.
borelli33

Thnak you to you both!
I am using Turbo C 3.0 compiler. I need to program all keys! From A-z to F-1 to F12 and Shift and caps lock.
Thank you cup and elli33, You have both anwsered both my questions.Thank you!
Alexander.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |