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
Analysis: Basically, it is the process of determining what requirement to be done before how it should be done. In order to accomplish this, the developer shows the existing sy

Explain about the non-repudiation? Non Repudiation: Assurance which the sender is provided along with proof of delivery and which the recipient is given along with proof

Write a short notes on transition from IPv4 to IPv6

The advantages of specifying parameters during instantiation method are: -  All values to all the parameters do not need to be specified. Only those parameters that are assigne

Q. Concurrently read exclusively write? It's one of the models based on PRAM. In this model, processors access the memory location simultaneously for reading whereas exclusivel

Explain the role of World Wide Web in the field of e-commerce.  In the 1990s, the arrival of the World Wide Web on the Internet had shown a turning point in e-commerce by givin

This is the MATLAB graphics system. It contains high-level commands for two-dimensional and three-dimensional data visualization, image processing, animation, and presentation grap

Interconnection Network Introduction This unit discusses the types and properties of interconnection networks.  In multiprocessor systems, there are multiple I/O modules


All digital devices are made from circuits whichcan be switched between two possible states.These two states are represented by a voltagelevel at the output of the circuit e.g. 0V