Question: Part 4 : write code in c + + and submit it to the autograder This is a code mimic the linux cp command. Here
Part : write code in c and submit it to the autograder This is a code mimic the linux cp command. Here are the requirements This program works by first prompting the user for the name of the source file and destinationfile. It shall include all necessary error checking, including ensuring that the source file exists.The main function should return upon successful execution and return upon error condition.Hint: int openconst char pathname int flags, modet mode; The program needs to pass several test cases set in the autograder.
It is a common practice to test the code using shell script in software engineering. We are notrequired to write test cases. Instead, students can submit the code to run the test inAutoGrader.For learning purposes, I attach an example for your reference:Test case example#binbashecho Hi this is the source file to be used" source.txtecho "This is an existing file to be used" existing.txtecho "Test case : destination file does not exist"if mycopy source.txt source.txtbak;thenecho "Using diff command to see if two files are same"diff source.txt source.txtbakelseecho "Something went wrong";fiecho "Test case : destination file already exist"if mycopy source.txt existing.txt;thenecho "Using diff command to see if two files are same"diff source.txt existing.txtelseecho "something went wrong"fiecho "Test case : source file does not exist"if mycopy noexistingfile destinationfile;thenecho "Using diff to compare two files"diff noexistingfile destinationfileelseecho "Something went wrong"fiAfter editing the above file, say, saving it as testScript, use the following command to make thefile executable by all: chmod x testScriptThen you will be able to type the following command line to execute the commands in the scriptin order to test your program: testScript
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
