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 a macro ? How it is defined ? Preprocessor' is a translation phase that is applied to  source code before the compiler  proper  gets  its  hands on  it.  Generally,  th

Explain File Transfer Protocol . FTP is utilized to exchange files among computer accounts, to transfer files among an account and a desktop computer (upload) or to access softw

Q. Explain about Deadlock Avoidance? To prevent deadlocks two kinds of techniques are used: 1) Static prevention:  It employs P and V operators in addition to Semaphores to

How many bits are required at the input of a ladder D/A converter, if it is required to give a resolution of 5mV and if the full scale output is +5V. Find the %age resolution.

write a program insert and remove value in queue.

The following branch prediction algorithms are suggested: 1) Guess that the branch will be taken if the previous one was taken; predict not taken otherwise. 2) Guess that the

What is branch instruction? As a result of branch instruction is a type of instruction which loads a latest values into the program counter.

Develop a regular expression for Real number with optional fraction and Identifier. (i) A regular expression for real number with optional fraction is [+ | -] (d) +. (d)* (i

Write a pseudocode for a program that reads a temperature as a whole number from a user and outputs a "probable" season (winter, sprint, summer, or fall) depending on the temperatu

The MSI chip 7474 is ? Ans. MSI chip 7474 is TTL, dual edge triggered D Flip-Flop.