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

Define both fork and vfork, How and when race conditions happen in process ...

How and when race conditions happen in process control? How can it be avoided? b. Differentiate among following functions giving related syntax: (i) fork and vfork (ii) w

Why we need the need of parallel computation, THE NEED OF PARALLEL COMPUTAT...

THE NEED OF PARALLEL COMPUTATION   With the growth of computer science, computational pace of the processors has also increased many a times. Though, there are definite constr

What is hard drive interface, Q. What is Hard Drive Interface? Secondar...

Q. What is Hard Drive Interface? Secondary storage devices need a controller to proceed as an intermediary between device and rest of the computer system. On some computers the

Embedded system design using c, W To date we have discussed elementary high...

W To date we have discussed elementary high level language programming and low level assembler programming, one of the benefits of C is the integration of both , this requires a re

Your worksheet and organizing the data, You presently work for an automotiv...

You presently work for an automotive parts supply store. Your company is growing, and is considering expansion. The company presently has three locations (North, South, and Central

Explain the stack in digital computers, Explain the stack in digital comput...

Explain the stack in digital computers The stack in digital computers is fundamentally a memory unit with an address register which can count only (after first value is loaded

What do you meant by extranets, Extranets can be also used to connect an in...

Extranets can be also used to connect an intranet to Internet so that remote offsite access can be made in a company's intranet by an authorized individual. This can facilitate thr

Electing neil, ELECTING NEIL : The response for this is, of course. In...

ELECTING NEIL : The response for this is, of course. In this case, we considered the point of the search or researching is to find an artifact  -  a word which is an anagram o

To show - hide the ssi document in the page, Step 1: Click on Edit Step ...

Step 1: Click on Edit Step 2: Select reference Step 3: Select Translation Step 4: Click on SSI Step 5: For showing the SSI file; choose one of the following options:

Example of unification, Example of Unification: Let now here, assume i...

Example of Unification: Let now here, assume instead that we had these two sentences as:  knows(john,X) → hates(john, X)  knows(jack, mary)  Thus here the predicate n

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