subject

Write a function read_int that mimics system call 5 (but only for non-negative integers). The function needs no input parameters but should return the integer generated by the user key presses (appropriately stored onto the stack). To read in an integer, your function should listen for and read in MMIO keyboard inputs until either (a) the user hits the enter key or (b) 10 characters have been exceeded [since the largest possible signed 32 bit integer is 2147483647, which has 10 characters]. If the user inputs an invalid character such as a letter (e. g., β€˜a’) or symbol (e. g., β€˜$’), your function should return -1 to indicate that an invalid number has been entered. Along the same lines, if the user tries to enter a negative number (e. g., contains β€˜-β€˜ character) or too large of a number (i. e., causes overflow), also have your function return -1. Lastly, if the user types no characters at all and hits the enter key, return -1. Here are some examples that you can use as test cases:

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
To move an excel worksheet tab, simply right-click on it drag and drop it double-click on it delete it
Answers: 1
question
Computers and Technology, 25.06.2019 02:30
Technology has changed communications by replacing or supplementing traditional modes of communication that were primarily
Answers: 2
You know the right answer?
Write a function read_int that mimics system call 5 (but only for non-negative integers). The functi...
Questions
question
Spanish, 22.10.2019 22:00
Questions on the website: 13722363