#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char c;
char nomefile1[]="parteHeader.inc" ;
char nomefile2[]="tabella.inc" ;
char nomefile3[]="footer.inc" ;
char nomefileMerge[]="primatabellaC.htm" ;
FILE * Fp1 ;
FILE * Fp2 ;
FILE * Fp3 ;
FILE * FpMerge ; Fp1 = fopen(nomefile1, "r");
if (Fp1==NULL)
{
printf("Impossibile aprire il file %s\n", nomefile1);
exit(-1);
}
Fp2 = fopen(nomefile2, "r");
if (Fp2==NULL)
{
printf("Impossibile aprire il file %s\n", nomefile2);
exit(-1);
}
Fp3 = fopen(nomefile3, "r");
if (Fp3==NULL)
{
printf("Impossibile aprire il file %s\n", nomefile3);
exit(-1);
} FpMerge = fopen(nomefileMerge, "w");
if (FpMerge==NULL)
{
printf("Impossibile aprire il file %s\n", nomefileMerge);
exit(-1);
}
while ((fscanf(Fp1, "%c", &c)) == 1)
fprintf(FpMerge,"%c", c);
while ((fscanf(Fp2, "%c", &c)) == 1)
fprintf(FpMerge,"%c", c);
while ((fscanf(Fp3, "%c", &c)) == 1)
fprintf(FpMerge,"%c", c);
fflush(Fp1);
fflush(Fp2);
fflush(Fp3);
fflush(FpMerge);
fclose(Fp1);
fclose(Fp2);
fclose(Fp3);
fclose(FpMerge);
return 0;
}