微信公众号 
图码生活

每天发布有五花八门的文章,各种有趣的知识等,期待您的订阅与参与
电脑报 1992-2001 十年文章全集
电脑报 1992-2001 十年文章全集
包含从 1992 年 - 2001 年间,两万余篇期刊文章,查询最少输入两个字符
随便看看
读取中
读取中
标题将文件分割备份的小程序
栏目多媒体技术与产品
发布1996-10-04
  copy/B 分割文件1+分割文件2+… 原来的大文件。
  /*-----cutfile.c-----*/
  #include<stdio.h>
  #include<conio.h>
  #include<io.h>
  main()
  {
  FILE *s-file,*d-file;
  char ch[80]="\0";
  int num,i,j=1;
  long size,len,k,sizel;
  clrscr();清屏
  printf("input source filename:");请输入源文件名
  scanf("%s",ch);
  s-file=fopen(ch,"rb");读源文件
  if(!s-file){printf("\nCan not open source file!\7");exit(1);}
  printf("\ninput size of each sub-file:");输入子目标文件的长度
  scanf("%1d",&size);
  len=filelength(fileno(s-file));
  num=len/size+1;
  j=1;
  for(i=1;i<num;i++)
  {
  printf("\ninput destination filename[%d]:",i);
  scanf("%s",ch);
  d-file=fopen(ch,"wb");
  if(!d-file){printf("\nCan not open output file!\7");exit(1);}
  size1=(j==num)?len%size:size;
  for(k=0;k<size1;k++)
  putc(getc(s-file),d-file);将源文件分割拷贝到各个子目标文件
  j++;
  fclose(d-file);
  }
  fclose(s-file);
  }