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. Explain Extended Binary Coded Decimal Interchange Code? Extended Binary Coded Decimal Interchange Code (EBCDIC) is a character-encoding format employed by IBM mainframes. It

Companding helps in reducing with respect to signal:  (A) Interference                    (B) Signal overloading (C) Non linearity                 (D) Quantization noise

what is the scope of doing a final year project on cloud computing?

What is the chief advantage of using virtual packets instead of frames? The router can't transfer a copy of a frame from one kind of network to another since the frame formats

Q. How a Procedure define in Assembly ? Procedure is defined within source code by placing a directive of form: PROC A procedure is terminated using: ENDP The

Exponential Search Another alternative to variable size decrease-and-conquer search is known as exponential search. This algorithm begins searching at the beginning of the list

Solve the assignment of NFA-- Finite Automata and Formal Language Project Description: I have an assignment on Finite Automata and Formal Languages ( Nondeterministic Fini

This project is aimed at developing a web-based and central recruitment Process system. this web site is for Fresher candidates who graduated. Some features of this system will be

What is called PCP? The phenomenon of un-decidability is not confined to problems concerning automata. An un-decidable problem concerning on simple manipulation of strings is k