Question
#include #include //copies the file void copyFile(FILE *sourceFile, FILE *destinationFile) { char ch; //Iterating file while( ( ch = fgetc(sourceFile) ) != EOF ) {
#include
#include
//copies the file void copyFile(FILE *sourceFile, FILE *destinationFile) { char ch; //Iterating file while( ( ch = fgetc(sourceFile) ) != EOF ) {
//Copying fputc(ch, destinationFile); } printf(" File Copying Successful!!!! "); }
//Main function int main(int argc, char *argv[]) { //hold file names char source[20], destination[20]; //Files for reading and writing
FILE *sourceFile, *destinationFile;
//Reading file printf(" Input Source File: ");
fgets(source); //Opening file sourceFile = fopen(source, "r");
//Validating file if( sourceFile == NULL ) { printf(" Error!!! Opening input file... Please try again... "); return -1; }
//Reading Destination file location printf(" Input Destination File: ");
fgets(destination); //Opening file in write mode destinationFile = fopen(destination, "w");
//Calling the function copyFile(sourceFile, destinationFile); //Closing file
fclose(sourceFile); fclose(destinationFile);
return 0;
}
how do I fix this error?
\fStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started