please guys help me
is it possible when i press 'a' on keyboard it should print 'n' on screen? I want c or c++ program
please guys help me
is it possible when i press 'a' on keyboard it should print 'n' on screen? I want c or c++ program
Yaswanth, No one on the board will write this program for you but it is possible to write a program that does what you're looking for. Choose the language you're comfortable with and take it from there. Post any attempts you have and we'll be glad to help you out.
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun
Why do you want to do this? Have you considered tools like AutoIt that might be able to do this?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
If your OS/compiler support the non-standard "conio" header file, then you can adapt an example from a FAQ on this site to achieve your goal.
FAQ > How can I get input without having the user hit [Enter]? - Cprogramming.com
Otherwise, you'd be better off looking into other libraries, or even other languages (as already mentioned in this thread).
ncurses is another option
There are many different ways you can do it. The smiples would to check the post#6 and read through the FAQ. When you enter key on a keyboard the corresponding ASCII valuecan be captured and check for if the the key just entered was 'a'. If it is then print 'n'.
But as said this is a very simple approch. But however it depends on what platform and OS your working on. You can use some rich of libraries such as ncurser.h on unix platfomr.Code:int CharEntered = KeyPress(); if( CharEntered == 65 || CharEntered == 97 ) { print("n") ); } can also be written if( CharEntered == 'a' || CharEntered == 'A' ) { print( "n" ); }
ssharish
Life is like riding a bicycle. To keep your balance you must keep moving - Einstein
Thank you very much. your code is simple and great
I want to modify my question. If I press 'a' then 'n' button should be pressed.
Can I achieve this by using
Code:CharEntered = KeyPress(); if( CharEntered == 65 || CharEntered == 97 ) { keybd_event VK_N, 0, 0, 0 ' press N keybd_event VK_N, 0, KEYEVENTF_KEYUP, 0 ' release N }