Arrow keys - input commands, Computer Engineering

When the user is inputting commands into your shell, it should identify the left, right , up and down arrow keys. To implement this, you will need to use the termios.h library to configure a custom input strategy. Remember that after changing the configuration, you should restore it to its original configuration before exiting the program. Also, change the reads to be non-canonical and disable echoing. This will give us control on how to handle each character the user inputs. It is tricky determining which character is left, right, up or down . Most characters are only one byte long. On the other hand, the character that is output when an arrow is pressed, is three bytes long. Here are the three byte sequences for left, right, up and down arrows:

l e f t --> {27 , 91 , 68}

r i g h t --> {27 , 91 , 67}

up --> {27 , 91 , 65}

down --> {27 , 91 , 66}

 Since we are not echoing characters, you will need to echo every character the user types. If left or right key is pressed nothing should happen. But if up or down arrow key is pressed it should work as described in the History section below.

Posted Date: 4/3/2013 2:57:26 AM | Location : United States

Related Discussions:- Arrow keys - input commands, Assignment Help, Ask Question on Arrow keys - input commands, Get Answer, Expert's Help, Arrow keys - input commands Discussions

Write discussion on Arrow keys - input commands
Your posts are moderated
Related Questions
Explain Concurrent sharing. Concurrent sharing: Some number of programs may share a file concurrently. While this is the case, this is essential to ignore mutual interferen

design a ciruit which can work as a 4-bit binary adder as well as subtractor

Explain clearly the four stages in the Rapid Application Development

Q. Illustrate about First Generation Computers? It is certainly ironic that scientific inventions of great impact have frequently been linked with supporting a very sad as well

What is a linker program? Ans. links the program with other programs required for its execution is called a linker program.

Explain the characteristics of vector processing

Describe your choice specifically and fully, explaining and discussing at length in what respects the advance builds upon or departs from present technology or practice and the sev

In a report with an LDB attribute, you do not have to explain how the information should be retrieved from the database tables, but only how the data should be shown on the screen.

What are the different ways synchronize between two clock domains? The following section describes clock domain interfacing one of the biggest challenges of system-on-chip (SOC

Disadvantages of random scan display - Just by wire-frame, it is almost impossible to create images with shaded objects or areas filled with a given colour. - In case