0
1.0kviews
Write a program to create copy of a file. Let the user specify names of source and destination files
1 Answer
0
17views
#include <stdio.h>
#include <stdlib.h>

int main()
{
char ch, source_file[20], target_file[20];
FILE *source, *target;
printf("Enter name of file to copy\n");
gets(source_file);

source = fopen(source_file, "r");

if( source == NULL )
{
  printf("Press any key to exit...\n");
  exit(EXIT_FAILURE);
 }

printf("Enter name of target file\n");
gets(target_file);

target = fopen(target_file, "w");

if( target …

Create a free account to keep reading this post.

and 5 others joined a min ago.

Please log in to add an answer.