C program which concatenate two file and write it third file.

source code


#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);
   getch();
   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);
   }
 } 

Comments

Popular posts from this blog

8086 STRING MANIPULATION –FIND AND REPLACE A WORD

Animated Circles In C++

C program to find out the sum of series 1 + 2 + …. + n.