#include <stdio.h> main() { FILE *fp1, *fp2; char ch; fp1 = fopen("abc.txt", "r"); fp2 = fopen("xyz.txt", "w"); while((ch = getc(fp1)) != EOF) putc(ch, fp2); fclose(fp1); fclose(fp2); getch(); }
OUTPUT:
STEP 1: Create a New Text Document and Rename it as "abc.txt" STEP 2: Write Some Content in that file and Save. STEP 3: Now Compile the C Program and RUN it. That's it. Now a new file will be created with a name "xyz.c" and all the content would copy from abc.txt to xyz.txt.