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

AI Applications Search is a crucial component of an AI system, and the search functions are performed over large quantities of difficult structured data using unstructured inpu

What are the Benefits of Web-Based Spreadsheets? The spreadsheets can be accessed from any Internet-connected computer, not just the computer originally formed the spreadsh

Q. Show block Diagram of sequential circuits? A sequential circuit is an interconnection of storage elements and combinational circuits. The storage elements known as flip-flop

Rational Testmanager is a complicated tool that can be used for automating performance tests on client/server systems. A client/server system have client applications accessing a d

What exactly is being serialized when you perform serialization? Serialization is the process of changing an object into stream of bytes. We perform it at the time of transpor

Differentiate between non-relocatable and relocatable programs. A non-relocatable program is one which cannot be executed in any memory area other than the area starting at i

draw input and output charectoristics of BJT and justify CE configuration provides large current amplification

1.  The network shown in figure 2 uses neurons with:             (a) Unipolar Binary;             (b) Bipolar Binary. Calculate a table of responses to all four possi

What is Control Unit Control Unit: The control unit issue control signals to perform exact operation and it directs the entire computer system to carry out keeps program instr