Copying content of one file to another file || File handling || C programming
In this program, we are going to copy the content of one file to another file with the help of C Programming Language.

 


#include <stdio.h>

void main()
{
    FILE *fp1, *fp2;
    char ch;
    fp1 = fopen("sample.txt", "r");
    fp2 = fopen("example.txt", "w");

    while ((ch = getc(fp1)) != EOF)
    {
        putc(ch, fp2);
    }

    fclose(fp1);
    fclose(fp2);
}

//.....coded by ANANYA MAURYA

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post