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 cobol codin for heap sort?

Functional units of a computer system: Digital computer systems consist of 3 distinct units. These units are as follows:  Central Processing unit Input unit and Output unit.

End systems are connected together by communication links. There are various types of communication links, which are made of numerous types of physical media, comprising twisted pa

Q. What is Compact Disk Read Only Memory? This technology has evolved out of entertainment electronics market where cassette tapes and long playing records are being replaced b

What is Linear Addressing Mode. Ans. Linear Addressing: Addressing is the procedure of selecting one of the cells in a memory to be written in or to be read from. So as to fa

Advantage  1.       By doing threading we neglect the recursive method of traversing a Tree , which makes use of stack and consumes many memory and time . 2.       The node

Why a computer expect to receive responses when it broadcast an ARP request? Response will be acquired only from the machine for that request is being sent not for the other ma

Using Web resource monitors we can search the performance of web servers. Using these monitors we can examine throughput on the web server, number of hits per second that happened

Synchronized with a clock signal Memory system considerations Speed Cost Size of chip Power dissipation Memory controller Refresh Overhead

function nor gates W=A,B,C,D=~(AB)*~(CD)