#define BUFFER_SIZE 1024
//合并文件mergeFile (infile1, infile2, filenmae)
void mergeFile(FILE *fp1,FILE *fp2,char *name){
FILE *fd1,*fd2,*fp3;
unsigned char buf[BUFFER_SIZE];
char filename[100];
strncpy(filename,name,sizeof(filename));
int rc1,rc2;
fd1 = fopen(fp1,"rb");
fd2 = fopen(fp2,"rb");
fp3 = fopen(filename, "wb" );
while( (rc1 = fread(buf,sizeof(unsigned char), BUFFER_SIZE,fd1)) != 0 )
{
fwrite( buf, sizeof( unsigned char ), rc1, fp3 );
}
while( (rc2 = fread(buf,sizeof(unsigned char), BUFFER_SIZE,fd2)) != 0 )
{
fwrite( buf, sizeof( unsigned char ), rc2, fp3 );
}
sleep(0.1);
fclose(fd1);
fclose(fd2);
fclose(fp3);
}