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
Q. What is multiplexer? Explain 4 X 1 Multiplexer.    Q. Explain the working of a Binary Half-Adder. Construct a Full-Adder from Half- Adder. Also draw the circuit diagram of full

Q. Show the Programmes for Parallel Systems? Adding elements of an array using two processor      int sum, A[ n] ;  //shared variables

Explain the mechanisms of propagation of radio communication. Radio communication deals along with electronic radiation of electromagnetic energy from one point to other by the

How Online Databases Work? An online or web-based database keeps data on a cloud of servers somewhere on the Internet, which is accessible by any authorized user with an Intern

A device, usually linked to a serial port of a computer, that transfer data over regular phone lines. Modem stands modulator demodulator; it changes a digital stream of data into s

a)   Make a cell array variable that would kept for a student his or her name, university id number, and GPA.  Print this information. b) Make a structure variable that would kept

Write a program to convert the given Decimal number into its equivalent Binary number.

Define a job scheduling strategy that will meet business requirement of reporting availability by 6am CST for the following cubes

Q. What do you mean by Supercomputers? The upper end of state of art mainframe machine is supercomputers. These are among the fastest machines in terms of processing speed and

A CSMA/CD bus spans a distance of 1.5 Km. If data is 5 Mbps, What is minimum frame size where propagation speed in LAN cable is 200 m µs. Usual propagation speed in LAN cables