The goal is to merge the strings from file1 and file2 but every time I try to do it only the first sentence of file 2 merges to file1. I don't understand why it's doing this and also I am new to programming and just started working with file pointers.
#include <stdio.h>
#include <string.h>
int main (int argc, char *argv[]){
FILE *fin1 = fopen(argv[1],"r");
FILE *fin2 = fopen(argv[2],"r");
FILE *fout = fopen(argv[3],"w");
char sentence1[1000];
char sentence2[500];
fgets(sentence1,1000,fin1);
fgets(sentence2,500,fin2);
strcat(sentence1,sentence2);
fprintf(fout,"%s",sentence1);
printf("%s",sentence2);
fclose(fin1);
fclose(fin2);
fclose(fout);
return 0;
}