| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2141 人关注过本帖
标题:新手写的一个好繁琐的程序,高手入
只看楼主 加入收藏
kof888
Rank: 1
等 级:新手上路
帖 子:26
专家分:1
注 册:2009-4-1
结帖率:60%
收藏
已结贴  问题点数:20 回复次数:26 
新手写的一个好繁琐的程序,高手入
别笑啊
  看看还能在简化下吗,我怕以后要是分成128或者256个文件手会酸死


//把1个文件分解成64份,其中按一个文件512字节的顺序放入新文件
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <windows.h>
void main()
{
 FILE *f0,*f1,*f2,*f3,*f4,*f5,*f6,*f7,*f8,*f9,*f10,*f11,*f12,*f13,*f14,*f15,*f16,*f17,*f18,*f19,*f20,*f21,*f22,*f23,*f24,*f25,*f26,*f27,*f28,*f29,*f30,*f31,*f32,*f33,*f34,*f35,*f36,*f37,*f38,*f39,*f40,*f41,*f42,*f43,*f44,*f45,*f46,*f47,*f48,*f49,*f50,*f51,*f52,*f53,*f54,*f55,*f56,*f57,*f58,*f59,*f60,*f61,*f62,*f63,*f64;

  if((f1=fopen("01.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f2=fopen("02.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f3=fopen("03.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f4=fopen("04.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }
   if((f5=fopen("05.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f6=fopen("06.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f7=fopen("07.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f8=fopen("08.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f9=fopen("09.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f10=fopen("10.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f11=fopen("11.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f12=fopen("12.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f13=fopen("13.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f14=fopen("14.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f15=fopen("15.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f16=fopen("16.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f17=fopen("17.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f18=fopen("18.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f19=fopen("19.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f20=fopen("20.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f21=fopen("21.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f22=fopen("22.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f23=fopen("23.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f24=fopen("24.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f25=fopen("25.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f26=fopen("26.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f27=fopen("27.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f28=fopen("28.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f29=fopen("29.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f30=fopen("30.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f31=fopen("31.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f32=fopen("32.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f33=fopen("33.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f34=fopen("34.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f35=fopen("35.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f36=fopen("36.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f37=fopen("37.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f38=fopen("38.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f39=fopen("39.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f40=fopen("40.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f41=fopen("41.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f42=fopen("42.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f43=fopen("43.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f44=fopen("44.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f45=fopen("45.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f46=fopen("46.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f47=fopen("47.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f48=fopen("48.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f49=fopen("49.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f50=fopen("50.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f51=fopen("51.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f52=fopen("52.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f53=fopen("53.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f54=fopen("54.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f55=fopen("55.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f56=fopen("56.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f57=fopen("57.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f58=fopen("58.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f59=fopen("59.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f60=fopen("60.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }  if((f61=fopen("61.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }  if((f62=fopen("62.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
  if((f63=fopen("63.bin","wb"))==NULL)
 {
  printf("cannot open file A\n");
  exit(0);
 }
 if((f64=fopen("64.bin","wb"))==NULL)
 {
  printf("cannot open file B\n");
  exit(0);
 }
 if((f0=fopen("C.bin","rb"))==NULL)
 {
  printf("cannot open file C\n");
  exit(0);

 }
char buffer[512];
//先获取文件长度;
long len,i;
fseek(f0,0,2);
len=ftell(f0);
fseek(f0,0,0);



for(i=len;i>0;i-=32768)/*一次处理了4子节*/

{
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f1);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f2);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f3);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f4);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f5);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f6);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f7);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f8);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f9);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f10);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f11);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f12);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f13);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f14);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f15);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f16);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f17);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f18);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f19);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f20);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f21);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f22);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f23);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f24);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f25);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f26);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f27);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f28);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f29);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f30);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f31);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f32);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f33);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f34);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f35);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f36);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f37);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f38);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f39);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f40);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f41);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f42);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f43);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f44);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f45);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f46);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f47);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f48);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f49);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f50);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f51);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f52);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f53);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f54);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f55);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f56);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f57);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f58);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f59);
  fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f60);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f61);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f62);
 fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f63);
fread(buffer,sizeof(buffer),1,f0);
 fwrite(buffer,sizeof(buffer),1,f64);
 
 
 
 
 
 
 
 
 
 
}

 fclose(f0);
 fclose(f1);
 fclose(f2);
 fclose(f3);
 fclose(f4);
 fclose(f5);
 fclose(f6);
 fclose(f7);
 fclose(f8);
 fclose(f9);
  fclose(f10);
 fclose(f11);
 fclose(f12);
 fclose(f13);
 fclose(f14);
 fclose(f15);
 fclose(f16);
 fclose(f17);
 fclose(f18);
 fclose(f19);
  fclose(f20);
 fclose(f21);
 fclose(f22);
 fclose(f23);
 fclose(f24);
 fclose(f25);
 fclose(f26);
 fclose(f27);
 fclose(f28);
 fclose(f29);
  fclose(f30);
 fclose(f31);
 fclose(f32);
 fclose(f33);
 fclose(f34);
 fclose(f35);
 fclose(f36);
 fclose(f37);
 fclose(f38);
 fclose(f39);
  fclose(f40);
 fclose(f41);
 fclose(f42);
 fclose(f43);
 fclose(f44);
 fclose(f45);
 fclose(f46);
 fclose(f47);
 fclose(f48);
 fclose(f49);
  fclose(f50);
 fclose(f51);
 fclose(f52);
 fclose(f53);
 fclose(f54);
 fclose(f55);
 fclose(f56);
 fclose(f57);
 fclose(f58);
 fclose(f59);
  fclose(f60);
 fclose(f61);
 fclose(f62);
 fclose(f63);
 fclose(f64);



 system("pause");
}
搜索更多相关主题的帖子: f44 include 
2009-08-05 19:47
godbless
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:1
帖 子:216
专家分:950
注 册:2009-7-24
收藏
得分:0 
佩服。。。
2009-08-05 19:58
wxjeacen
Rank: 7Rank: 7Rank: 7
等 级:禁止访问
帖 子:1291
专家分:628
注 册:2009-3-22
收藏
得分:0 
nb

生命不熄,战斗不止.
2009-08-05 20:15
黒渍
Rank: 2
等 级:论坛游民
帖 子:57
专家分:41
注 册:2009-7-16
收藏
得分:0 
人才。。。

踏实学C
/*我的编程飞信群:9401431 互相学习,共同进步*/
2009-08-05 20:33
kof888
Rank: 1
等 级:新手上路
帖 子:26
专家分:1
注 册:2009-4-1
收藏
得分:0 
都说了别笑啊,大家帮帮忙啊
2009-08-05 20:55
lishizelibin
Rank: 2
等 级:论坛游民
帖 子:513
专家分:41
注 册:2007-5-10
收藏
得分:0 
,顶你!

惟有学习不断的学习!
2009-08-05 20:58
VV程序员
Rank: 1
等 级:新手上路
帖 子:20
专家分:1
注 册:2009-1-14
收藏
得分:0 
   用什么软件编写的??? VC++6.0??
2009-08-05 21:18
紫ing~
Rank: 4
来 自:中科大
等 级:业余侠客
帖 子:103
专家分:273
注 册:2008-11-25
收藏
得分:0 
膜拜。。。。。

唯有天道恒在,往复循环,不曾更改。。。
2009-08-05 21:19
edsanxi520
Rank: 1
等 级:新手上路
帖 子:86
专家分:2
注 册:2008-4-5
收藏
得分:0 
NB
2009-08-05 21:20
VV程序员
Rank: 1
等 级:新手上路
帖 子:20
专家分:1
注 册:2009-1-14
收藏
得分:0 
我晕  用个循环不就行了??
2009-08-05 21:20
快速回复:新手写的一个好繁琐的程序,高手入
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034192 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved