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

What do you mean by true complement method, Q. What do you mean by True Com...

Q. What do you mean by True Complement Method? Explain in detail. Q. Show IEEE format for (12.75)10. Q. What are the various ways to represent Negative Numbers in computer sy

Operations from events, Operations from events During analysis, events...

Operations from events During analysis, events which are sent to target objects. An operation on these object are presented as labels on transitions and should not be explicit

Describe independent loops in fortran, Q. Describe Independent Loops in for...

Q. Describe Independent Loops in fortran? HPF offers extra opportunities for parallel execution by employing the INDEPENDENT directive to declare the iterations of a do-loop is

What are the advantages of using structure in c program, What are the advan...

What are the advantages of using structure in C Program Declaring a struct is a two-stage process. The first stage defines a new data type that has the required structure which

What is the necessity of interfacing in digital ic, What is the necessity o...

What is the necessity of Interfacing in digital ICs and what are the points to be kept in view, while interfacing between TTL gate and CMOS gate? Ans: To realize the optimum

Microprocessor, can i get the comparison of microprocessors architecture?

can i get the comparison of microprocessors architecture?

What is turnaround time, What is turnaround time? Turnaround time is th...

What is turnaround time? Turnaround time is the interval from the time of submission to the time of completion of a process. It is the sum of the periods spent waiting to get i

RISC performance using optimizing compilers, Q. RISC Performance using opti...

Q. RISC Performance using optimizing compilers? Performance using optimizing compilers: As instructions are simple compilers can be developed for efficient code organization a

Show the layout of dvorak-dealey keyboard, Q. Show the layout of Dvorak-Dea...

Q. Show the layout of Dvorak-Dealey keyboard? This was one keyboard layout designed to be a challenger to QWERTY layout. This was designed by August Dvorak and William Dealey a

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