C Program to Copy Text From One File to Other File


Program : Copy Text From One File to Other File

Explanation :

 
To copy a text from one file to another we have to follow following Steps :
Step 1 : Open Source File in Read Mode

Step 2 : Open Target File in Write Mode

Step 3 : Read Source File Character by Character

  • “fgetc” will read character from source file.
  • Check whether character is “End Character of File” or not , if yes then Terminate Loop
  • “putc” will write Single Character on File Pointed by “fp2” pointer

Input Text File :

Output Written on File