#include <stdio.h>
main()
{ char c1,c2;
int i;
FILE*fp1,*fp2;
if ((fp1=fopen("E:\\f1.txt","w+"))==NULL)
{ printf("Can't open f1.txt.\n"); exit(0); }
if((fp2=fopen("E:\\f2.txt","w"))==NULL;
{ printf("Can't open f2.txt\n");exit(0);}
for (i=0;i<3;i++)
{ scanf("%c%*c",&c1); putc(c1,fp1); }
for (i=0;i<3;i++)
{ scanf("%c%*c",&c2); putc(c2,fp2);}
fputc(0xff,fp1);
fclose(fp2);
rewind(fp1);
if((fp2=fopen("E:\\f2.txt","a"))==NULL)
{ printf("Can't open f2.txt.\n");exit(0); }
while((c1=getc(fp1))!=EOF)
{ putc(c1,fp2); }
fputc(0xff,fp2);
fclose(fp2);
fclose(fp1);
printf("f2.txt file output : \n")
fp2=fopen("E:\\f2.txt","r"):
while((c1=getc(fp2))!=EOF) { printf("%c",c1); }
printf("\n");
flcose(fp2);
system("pause");
}