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
What is C++ reference and JAVA final? Association ends must be bound at initialization and cannot be altered. C++ references can fully enforce these semantics, and the JAVA fin

Question: Logical User-Centered Interactive Design Methodology is a methodology that identifies six clear stages to help in software development while keeping the user in mind.

List the various file attributes. A file has certain other attributes, which differ from one operating system to another, but typically consist of these: Name, identifier, type

Architecture of Artificial neural networks: Presumably "Artificial Neural Networks" consist of a number of units that are mini calculation devices. But they take in real-value

De Morgan's Laws Continuing with the relationship between  ∧  and  ∨ , we can also use De Morgan's Law to rearrange sentences involving negation in conjunction with these conne

Bus arbitration: In single bus architecture when more than 1 device requests the bus, a controller known as bus arbiter decides who gets the bus; this is known as the bus arbi

MX is conceptually easy, yet bears the fruit of years of domain experience and research. In a nutshell, JMX describes a standard means for applications to expose management functio

What are interrupts?  Interrupt: An interrupt is a hardware mechanism which enables an external device, classically input/output devices, to send a signal to the CPU. An int

Q. Functional Requirements of a Control Unit? Let's first try to define functions that a control unit should perform in order to get things to happen. However in order to defin

Explain the various interface circuits.  An I/O interface having of circuitry required to connect an I/O device to computer bus. One side having of a data path with its associa