হোমc string c program to read a string from a file and write it to the another file byengr. ahsan arif -মার্চ ০৫, ২০১৫ 1 Write a c program to read a string from a file and write it to the another file << Go to Index Page >> Tags c string character array file fprintf() fscanf() pointer and file string array Facebook Twitter
#include
উত্তরমুছুন#include
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.");
exit(EXIT_FAILURE);
}
printf("Enter name of target File:\n");
gets(target_file);
target=fopen(target_file,"w");
if(target==NULL)
{
fclose(source);
printf("Press any key to exit.");
exit(EXIT_FAILURE);
}
while((ch=fgetc(source))!=EOF)
fputc(ch,target);
printf("File copied Successfully");
fclose(source);
fclose(target);
return 0;
}