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
Given a dataset with 1000 rows and 25 predictors labeled x1, x2, ...,x25 to classify into two classes {a, b}. Consider the small random forest with 3 trees and one split in each tr

Q. Explain SR Latch using NOR gates? Let's inspect the latch more closely.   i. Suppose initially 1 is applied to S leaving R to 0 at this instance. The instant S=1 output o

Explain the Accuracy o f an ADC. Ans Accuracy- The accuracy of D to A converter is the difference among actual output voltage and the expected output voltage in D to A c

Q. What do you mean by Daisy chain? This scheme provides a hardware poll. With this scheme, an interrupt acknowledge line is chain by different interrupt devices. All I/O inter


What are the functions of passes used in two-pass assembler? In an assembly language program, two pass translations can handle forward references early. The subsequent task

The most expensive method of accessing Internet is to use leased lines which connect directly to the ISP. This will increase access rate to anywhere between 64 K and 1.5 Mbps, rely

Q. Define Colour Depth in graphic display system? It is clear that an image contains an array of pixels.  If we tell which pixels are 'off' and which are 'on' to the monitor, i

An 8-bit successive approximation ADC has a resolution of 20mV.  What will be its digital output for an analog input of 2.17V? Ans: Given data Resolution =20mv Analog input =2.

For executing recursive function the data structure used is: For executing recursive function, stack is used as a data structure.