#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); }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
  • 2021-05-21
  • 2022-12-23
  • 2022-12-23
  • 2023-04-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2021-08-09
  • 2022-03-03
  • 2021-06-08
相关资源
相似解决方案