Arrow keys - input commands, Computer Engineering

Assignment Help:

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.


Related Discussions:- Arrow keys - input commands

Why are binary, Q. Why are binary, octal and hexadecimal used for computer ...

Q. Why are binary, octal and hexadecimal used for computer applications? Q. Perform the following: (189.3) 10 = (?) 2

What is source and listener, A source is an object that produces an event. ...

A source is an object that produces an event. This happens when the internal state of that object changes in some way. A listener is an object that is notified when an event happen

Concepts of an address and data, The heart of a computer is often one integ...

The heart of a computer is often one integrated circuit; one typical circuit is a 68Hc11 Microprocessor. Let us consider a typical 68Hc11 hardware design.           The mic

What are the phases of swapping a page from the memory, What are the phases...

What are the phases of swapping a page from the memory? Page stealer searches the page eligible for swapping and places the page number in the list of pages to be swapped. K

Explain about local area network, Q. Explain about Local Area Network? ...

Q. Explain about Local Area Network? Local Area Network (LAN):  It is privately owned communication systems that cover up a small area, say a complex of buildings or school. Le

Explain bitwise operator, Bitwise Operators Like  other  operators  bit...

Bitwise Operators Like  other  operators  bitwise  operators  have  rules  of  precedence  and  associativity  that determine how expressions involved them are evaluated.

Why is packet switching important, Why is packet switching important? Give ...

Why is packet switching important? Give at least two reasons. Packet switching is significant due to the following two purposes: 1. A sender and the receiver require coordin

Infix to reverse polish, A) Change the following formulas from reverse Poli...

A) Change the following formulas from reverse Polish to infix:             a) AB +C + D x               b) ABCDE + x x / B) Change the following formulas from infix to

Explain cgi standard, Explain CGI standard. The CGI Standard: Techno...

Explain CGI standard. The CGI Standard: Technology utilized for building dynamic web documents is termed as Common Gateway Interface (CGI). The CGI standard gives how a serv

Flat, nfa significance

nfa significance

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd