Question: Hi, I need help with this c++ program: File Copy The program asks the user to enter a name of a file; and then, creates

Hi, I need help with this c++ program:

File Copy

The program asks the user to enter a name of a file; and then, creates a copy of the file. This program defines the following function:

void copyFile(char* filename)

This function tries to open the file, filename, for reading. If the file does not open, display the message File cannot open and terminate the function.Otherwise, open a new file for writing, then copy the content of the original file to the new file.

The name of the new file should be _cp_ appended to the beginning of the name of the original file.

For example, if the original file is named sample.txt, then the new file name would be _cp_sample.txt.

Use the strcat() function to create the new file.

Reminder: Whenever you open a file, you must remember to close it.

In the main, Create a char array.

Prompt the user to enter a file name.

Store the input of the user in the char array.

Call the copyFile() function with the char array as the argument.

The program should begin as follows:

#include ;

#include

#include

using namespace std;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!