Solved

Keyboard Work..(Misc)

Posted on 2000-02-28
4
208 Views
Last Modified: 2010-04-02
Hello,

When we press any key present in the keyboard, for ex(Enter key), it is echoed on the screen.  Is it possible to do the same work with any kind of code/functions prebuilt. If so, please help me. thanks

--gsbabu
0
Comment
Question by:gsbabu
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Binder
ID: 2566313
 Sorry, I don´t understand what you want to do. Do you
want to build a library of keyboard functions? What is your O.S.?
0
 
LVL 22

Expert Comment

by:nietod
ID: 2566361
Standard C++ doesn't allow for this.  all input is echoed and line buffered (the user has to presse enter before your program gets the input.

But many compilers provide non-stnadard functions that will allow you to obtain input without line buffering and/or echoing.  So what compiler are you using?   You might try looking for a function called KeyPressed() and one called ReadKey(), which I beleive were used by Borland compilers for the Mac.
0
 

Author Comment

by:gsbabu
ID: 2566382
Hi

i am using gcc on solaris 2.6. more helps/suggesstions appreciated.

-gsbabu
0
 
LVL 22

Accepted Solution

by:
nietod earned 65 total points
ID: 2566474
"Misc"?  I thought you said "Mac"

for unix, you want to use the curses library.  This is a library of functions for controling the keyboard input and display output.  It has features for performing input without echoing and without line buffering and features for controlling the display, like moving the cursor and hiding the cursor etc.

You will need to include the curses.h file and link to the curses.o (right extension?) library.  This is all documented in your man pages.

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question