Question: Consider using a word processor. If you were writing high-level code for reading and writing a file, what system calls would you expect? Use C-like
Consider using a word processor. If you were writing high-level code for reading and writing a file, what system calls would you expect? Use C-like pseudocode to structure your answer for in terms of two functions: readFile and saveFile. Hint for pseudocode outline: Use a temp file/variable to buffer the contents of a file. In readFile, read a File to the temp file (can use a global variable), so user can read and then edit. When user saves the temp file, it will be written back to the file. (Slide 10 may help.)
SYSTEM CALLS source file destination file .A SYstem call is a call that invokes some loW level subroutine that likely requires a high level of privilege such that the OS alone offers Example System Call Sequence Acquire input file name Write prompt to screen its service Accept input Acquire output file name Write prompt to screen Consider an example program that makes a Accept input copy of a file. How many system level calls are Open the input file needed? if file doesn't exist, abort Create output file if file exists, abort Loop "Fetch Parameters: read fllename, display message Open: open flles, checks errors (display, Read from input file terminate) Copy: read from src, write to dest Close: close lles, display message, terminate Write to output file Until read fails Close output file Write completion message to screen Terminate normally 10 Image from Operatin tem Concepts
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
