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 are the characteristics of semiconductor RAM memories? They are available in a wide range of speeds. Their cycle time range from 100ns to less than 10ns. The

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example

Error-correcting code memory (ECC memory) is a type of computer data storage that can notice and correct the more general kinds of internal data corruption. ECC memory is used in m

Introduction Our research methodology requires gathering relevant data from the specified documents in order to analyze the material and arrive at more complete understanding

A 2-digit BCD D/A converter is a weighted resistor type with E R = 1 Volt, with R = 1M? , R f = 10K? . Find resolution in Percent and Volts. Ans. Resolution = 1/2 2 = 0.25 vo

In the data parallel model, many of the parallel work focus on performing operations on a data set. The data set is usually organized into a common structure, such as an array or a

The conversation speed of an analog to digital converter is maximum with which technique? Ans. With parallel comparator AD converter technique the conversation speed of an ana

What are the Difference between $display and $strobe Difference between $display and $strobe is that $strobe displays parameters at the very end of current simulation time unit

Backpropagation Learning Routine: Conversely as with perceptrons there the information in the network is stored in the weights than the learning problem comes down to the ques

Define the Edge-Triggered Flip-flops? An edge-triggered flip-flop changes states either at the negative edge (falling edge) or at the positive edge (rising edge) of the clock p