Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------------------------------------------
- #pragma hdrstop
- //---------------------------------------------------------------------------
- #pragma argsused
- #include <conio.h>
- #include <stdio.h>
- #include <stdlib.h>
- int ReadnPrint (char *filename1, char *filename2, char *filename3)
- {
- FILE *f,*g,*h;
- char line1[500], line2[500], line3[500]; char c;
- if((f=fopen(filename1,"rt"))==NULL)
- printf("File could not be opened\n");
- if((g=fopen(filename2,"rt"))==NULL)
- printf("File could not be opened\n");
- if((h=fopen(filename3,"wt"))==NULL)
- printf("File could not be opened\n");
- while (fgets(line1,500,f)!=NULL && fgets(line2,500,g)!=NULL)
- {
- fputs(line1,h);
- if(strcmp(line2, line1)!=0)
- fputs(line2,h);
- }
- fclose(f);
- fclose(g);
- fclose(h);
- return 0;
- }
- int main ()
- {
- char *filename1="F:\\1.txt";
- char *filename2="F:\\2.txt";
- char *filename3="F:\\3.txt";
- ReadnPrint ("F:\\1.txt","F:\\2.txt","F:\\3.txt");
- printf("Operation Complete.");
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement