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
Why is TCP called end-to-end protocol? TCP is termed as an end-to-end protocol as this provides a connection directly by an application in one computer to an application on a r

c programming code for pebble merchant

Differentiate between static and dynamic step loops. Step loops fall into two classes: Static and Dynamic.  Static step loops have a fixed size that cannot be changed at runti

Perform multiplication with showing the contents of accumulator, B register and Y register during each step. (Accumulator, B, Y are 4-bit registers) B=06 Y=02

(a) Write short notes on displacement only addressing mode. (b) Explain the formats of a 80-bit floating point number. (c) Given the following assembly program. Instructi

Question: a) Why do we use the Internet as the new distribution channel for e-banking products and services? b) In the context of e-banking or e-commerce, outline some o

By using XNOR gate if the signals are similar then only the output will be one otherwise not.

What is co-operative process? A process is co-operating if it can affect or be affected by the other processes implementing in the system. Any process that share data with othe

Shell is the exclusive feature of? Ans. Shell is the exclusive feature of UNIX.

Problem: (a) IEEE802.11 supports two types of network architecture, describe these architectures with the support of diagrams detailing the network components. (b) The MAC