CONCATENATE MANY FILES AND STORE THEM IN A FILE IN C





Concatenate many files and store them in a file in c programming language


#include<stdio.h>
 void concatenate(FILE *fp1,FILE *fp2,char *argv[],int argc);
 int main(int argc,char *argv[]){
   FILE *fp1,*fp2;
   concatenate(fp1,fp2,argv,argc);
   return 0;
 }

void concatenate(FILE *fp1,FILE *fp2,char **argv,int argc){
   int i,ch;
   fp2=fopen("files","a");
   for(i=1;i<argc-1;i++){
      fp1=fopen(argv[i],"r");
      while((ch=getc(fp1))!=EOF)
      putc(ch,fp2);
   }
 } 





2.  Write a c program to delete a file.
3. Write a c program to copy a file from one location to other location.
6. Write a c program which writes string in the file.

No comments: