Transfer The File One Place to another


            #include<stdio.h>

            main()
            {
                FILE *fp, *fp2;
                char ch;
                clrscr();  /* Non-standard, remove if using modern compilers */
                fp = fopen("file2.c", "rt");
                fp2 = fopen("filenew.c", "wt");
        
                if (fp == NULL || fp2 == NULL)
                {
                    printf("Error opening file(s)");
                    return;
                }
        
                while((ch = fgetc(fp)) != EOF)
                {
                    fputc(ch, fp2);
                    printf("%c", ch);
                }
        
                fclose(fp);
                fclose(fp2);
        
                getch();  /* Non-standard, remove if using modern compilers */
            }
        

Output: