Updated 3/29 with project grading %s CS 3377 Project The goal: create several versions of a process that updates and saves a binary file as a new file. The Setup This project will be done in 4 parts. To keep them separate, I implemented a factory pattern so that you (and the autograder) can test each copying method separately. It will look like this: FileModifierFactory: creates 1. Part1SimpleFileModifier: fill in during part 1 2. Part2MultiProcessModifier: fill in during part 2 3. Part3ThreadedModifier: fill in during part 3 4. Part4SocketModifier: fill in during part 4 You will be given (and not need to modify): 1. main.cpp. Launches the appropriate test based on the arguments 2. Util.cpp/h. Includes some useful attributes. 3. FileModifierFactory.cpp & .h. These build the proper PartXModifier based on the argument. 4. PipeCopier.cpp & .h. Helps you with the pipe for part 2. While each part will be tested separately, you are encouraged to reuse code as much of it will be useful for multiple parts. The File The file you are to read, modify, and save is a binary file that contains a sales list. A binary file is a non-text file, meaning some things (like numbers) aren’t stored as digits but as the ints/floats you use as variables. The name of the files to read and write will be in Util.h. The file will be structured like this: Field Size Type Purpose HEADER NumEntries 4 bytes Integer Tells you how many entries you need to read ENTRY (repeated NumEntries times) Date/Time sizeof(time_t) Time Timestamp (# seconds since 1/1/1970) Item ID Sizeof(int) Integer Item’s code Item Name 50 bytes char* Name of the item sold Item Quantity Sizeof(int) Integer Number sold Item Price Sizeof(float) Float Price of the products What You’ll Do In each part, the goal is to copy the file, adding two additional sales: 1. The Sobell book: a. Time 1612195200 (2/1/2020 4 PM GMT) b. ID 4636152 c. Name “A Programming Guide to Linux Commands, Editors, and Shell Programming by Sobell” [warning: this is more than 49 characters, so you have to truncate it—I say 49 because you need a null terminator] d. Quantity: 70 e. Price: 70.99 2. The Advanced Programming book a. Time 1613412000 (2/15/2020 6 PM GMT) b. ID 6530927 c. Name “Advanced Programming in the UNIX Environment by Stevens and Rago” [warning: more than 49 characters again] d. Quantity: 68 e. Price: 89.99 Be sure to update the total number of entries to account for these new ones. Part 1 (Due 3/29, worth 20%) You will read in the file (Util::inputFileName), add the two entries, and save the file (Util::outputFileName) using open(), close(), read(), and write(). You must use the low-level functions we will talk about in APUE chapter 3 (open, close, read, write). Failure to do so will result in 0 points for this part of the project. It is highly recommended that you do the file reading and writing in class(es) outside Part1SimpleFileModifier, as that code will be useful later. Part 2 (Due 4/12, worth 20%) In this case you will spawn a new process using fork() and exec(), and split the responsibilities like this: 1. The original process will read the file (2nd argument=2) and then write the data over a pipe to the child process. 2. The child process will read the file from the pipe (which will be set to standard input) and write the data to the output file. 3. PipeMaker will take care of the pipe setup for you: a. Create PipeMaker before the fork. b. In the parent process, call setUpToWrite() to ready this process for writing. You’ll get back the file descriptor to write to. Write the file data to that file descriptor (hint: it’s just like writing to a file). c. In the child process, before execing, call setUpToRead() to dup the pipe output to standard input. You can then exec the process (21S_CS3377_Project) with the write option (2nd argument=3), read the data from standard input (just a file descriptor, remember!), and write to the output file. d. Either the parent or the child process can do…

Looking for solution of this Assignment?


We deliver quality original papers

Our experts write quality original papers using academic databases.  

Free revisions

We offer our clients multiple free revisions just to ensure you get what you want.

Discounted prices

All our prices are discounted which makes it affordable to you. Use code FIRST15 to get your discount

100% originality

We deliver papers that are written from scratch to deliver 100% originality. Our papers are free from plagiarism and NO similarity

On-time delivery

We will deliver your paper on time even on short notice or  short deadline, overnight essay or even an urgent essay