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 working of DotMatrix or InkJet Printers? Three major issues consider the quality of characters generated by DotMatrix/InkJet Printers: - Number of dots in the matrix

Q. Use of parallel construct with private clause? In this example we would see use of parallel construct with private and firstprivate clauses. At end of program i and j remain

The 68Hc11 is actually a complex micro-controller its contains internally RAM, EEPROM, Parallel IO and serial ports, hardware timers and a 8 channel ADC.  The internal structure is

Q. Define COM Programs? A COM (Command) program is binary image of a machine language program. It is loaded in memory at the lowest available segment address. Program code star

Determine in detail about MP3 (MPEG-3) MPEG-3 uses an audio compression technology; it compresses CD-quality sound by a factor of about 10 while retaining most of the quality f

Q. What is Multiple Interrupt Lines? Multiple Interrupt Lines: Simplest solution to problems above is to provide multiple interrupt lines that will result in immediate recognit

Charles Babbage 'The grandfather of modern computer' had designed two computers: The Difference Engine: It was based on mathematical principle of finite differences and was us

What is Page-Stealer process? This is the Kernel process that makes rooms for the incoming pages, by swapping the memory pages that are not the part of the working set of a pro

Q. Explain about integrated circuit? An integrated circuit is created on a thin wafer of silicon that is splitted into a matrix of small areas (size of the order of a few m.m.

Cache Misses Compulsory misses -  it is caused by initial access to a block that has never been in the cache (also called cold start misses Capacity miss - it is cause