int main(int argc ,char **argv)
{
FILE *fp1,*fp2,*fp3;
long lenth1=0,len1=0;
long sum=0,len2,len3;
long lenth=0;
int i,j;
int flag=1;
char line1[M],line2[M];
char ch;
void mobi(char *a,char *b,char *c,char *d,char *e) /*手机字典生成函数*/
{
FILE *fp;
char *aa=a;
char *bb=b;
char *cc=c;
char *dd=d;
char *ee=e;
char ch;
int p,q,j;
long m,n,i;
long lenth=0;
if((fp=fopen(aa,"w+"))==NULL)
{
printf("Can't open the file %s\n",aa);
exit(0);
}
p=atoi(bb);
q=atoi(cc);
m=atol(dd);
n=atol(ee);
if(p>q||m>n) /*排错处理*/
{
printf("error,p must <= q or m <= n please input again:\n");
exit(0);
}
for(j=p;j<=q;j++)
for(i=m;i<=n;i++)
fprintf(fp,"%d%ld\n",j,i,fp);
rewind(fp);
while((ch=fgetc(fp))!=EOF)
{
if(ch=='\n')
++lenth;
}
printf("done.\nthe file has %ld words in %s\n",lenth,aa);
fclose(fp);
}
void tel(char *a,char *b,char *c,char *d) /*电话字典生成函数*/
{
FILE *fp;
char *aa=a,*bb=b,*cc=c,*dd=d;
int p,w=0;
char ch;
long m,n,i;
long lenth=0;
if((fp=fopen(aa,"w+"))==NULL)
{
printf("Can't open the file %s\n",aa);
exit(0);
}
p=atoi(bb);
m=atol(cc);
n=atol(dd);
if(m>=n)
{
printf("error.start_n must <= end_n\n");
exit(0);
}
if(p>=1000)
{
for(i=m;i<=n;i++)
fprintf(fp,"%d%ld\n",p,i);
}
else
{
for(i=m;i<=n;i++)
fprintf(fp,"%d%d%ld\n",w,p,i);
}
rewind(fp);
while((ch=fgetc(fp))!=EOF)
{
if(ch=='\n')
++lenth;
}
fclose(fp);
printf("\nDone.\nThe file has %ld hang in %s.\n",lenth,aa);
}
void birth(char *a1,char *b1,char *c1,char *d1,char *e1,char *f1,char *g1,char *h1)
{
FILE *fp;
char *aa=a1,*bb=b1,*cc=c1,*dd=d1,*ee=e1,*ff=f1,*gg=g1,*hh=h1;
long int lenth=0;
int a,b,c,d,e,f,h,m=0;
char ch,ch1='//',ch2=':',ch3='.',ch4='-',ch5='\\';
if((fp=fopen(bb,"w+"))==NULL)
{
printf("Can't open the file %s.\n",bb);
exit(0);
}
if(a>d||b>e||c>f)
{
printf("error.check it again.\n");
exit(0);
}
while(a<=d)
{
switch(h)
{
case 1:
if(b<10&&c<10)
fprintf(fp,"%d%d%d%d%d\n",a,m,b,m,c);
if(b>=10&&c<10)
fprintf(fp,"%d%d%d%d\n",a,b,m,c);
if(b<10&&c>=10)
fprintf(fp,"%d%d%d%d\n",a,m,b,c);
if(b>=10&&c>=10)
fprintf(fp,"%d%d%d\n",a,b,c);
break;
case 2:
if(b<10&&c<10)
fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch1,m,b,ch1,m,c);
if(b>=10&&c<10)
fprintf(fp,"%d%c%d%c%d%d\n",a,ch1,b,ch1,m,c);
if(b<10&&c>=10)
fprintf(fp,"%d%c%d%d%c%d\n",a,ch1,m,b,ch1,c);
if(b>=10&&c>=10)
fprintf(fp,"%d%c%d%c%d\n",a,ch1,b,ch1,c);
break;
case 3:
if(b<10&&c<10)
fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch2,m,b,ch2,m,c);
if(b>=10&&c<10)
fprintf(fp,"%d%c%d%c%d%d\n",a,ch2,b,ch2,m,c);
if(b<10&&c>=10)
fprintf(fp,"%d%c%d%d%c%d\n",a,ch2,m,b,ch2,c);
if(b>=10&&c>=10)
fprintf(fp,"%d%c%d%c%d\n",a,ch2,b,ch2,c);
break;
case 4:
if(b<10&&c<10)
fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch3,m,b,ch3,m,c);
if(b>=10&&c<10)
fprintf(fp,"%d%c%d%c%d%d\n",a,ch3,b,ch3,m,c);
if(b<10&&c>=10)
fprintf(fp,"%d%c%d%d%c%d\n",a,ch3,m,b,ch3,c);
if(b>=10&&c>=10)
fprintf(fp,"%d%c%d%c%d\n",a,ch3,b,ch3,c);
break;
case 5:
if(b<10&&c<10)
fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch4,m,b,ch4,m,c);
if(b>=10&&c<10)
fprintf(fp,"%d%c%d%c%d%d\n",a,ch4,b,ch4,m,c);
if(b<10&&c>=10)
fprintf(fp,"%d%c%d%d%c%d\n",a,ch4,m,b,ch4,c);
if(b>=10&&c>=10)
fprintf(fp,"%d%c%d%c%d\n",a,ch4,b,ch4,c);
break;
case 6:
fprintf(fp,"%d%d%d\n",a,b,c);
break;
case 7:
fprintf(fp,"%d%c%d%c%d\n",a,ch1,b,ch1,c);
break;
case 8:
fprintf(fp,"%d%c%d%c%d\n",a,ch2,b,ch2,c);
break;
case 9:
fprintf(fp,"%d%c%d%c%d\n",a,ch3,b,ch3,c);
break;
case 10:
fprintf(fp,"%d%c%d%c%d\n",a,ch4,b,ch4,c);
break;
case 11:
fprintf(fp,"%d%c%d%c%d\n",a,ch5,b,ch5,c);
break;
case 12:
if(b<10&&c<10)
fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch5,m,b,ch5,m,c);
if(b>=10&&c<10)
fprintf(fp,"%d%c%d%c%d%d\n",a,ch5,b,ch5,m,c);
if(b<10&&c>=10)
fprintf(fp,"%d%c%d%d%c%d\n",a,ch5,m,b,ch5,c);
if(b>=10&&c>=10)
fprintf(fp,"%d%c%d%c%d\n",a,ch5,b,ch5,c);
break;
}
c++;
if(a==d)
{
if(b>=e&&c>f)
break;
}
if(c>31)
{
b++;
c=1;
if(b>12)
{
a++;
b=1;
}
}
}
rewind(fp);
while((ch=fgetc(fp))!=EOF)
{
if(ch=='\n')
lenth++;
}
fclose(fp);
printf("\ndone.\nThe file has %ld hang in %s\n",lenth+1,bb);
}
void a_file(int len,char **line)
{
FILE *s_fp,*t_fp;
int i=2;
int flag=1;
long int lenth=0;
long int sum=0;
char buffer[Max];
char buffer1[Max];
char ch;
char ch1='\n';
if((s_fp=fopen(line,"w+"))==NULL)
{
printf("Can't open the file %s.\n",line);
exit(0);
}
if((t_fp=fopen(line[i+1],"a"))==NULL)
{
printf("Can't open the file %s.\n",line[i+1]);
exit(0);
}
fseek(t_fp,-1L,2);
if((ch=fgetc(t_fp))!='\n')
{
printf("%c\n",ch);
fputs("\n",t_fp);
}
fclose(t_fp);
if((t_fp=fopen(line[i+1],"r"))==NULL)
{
printf("Can't open the file %s.\n",line[i+1]);
exit(0);
}
while(fgets(buffer,512,t_fp)!=NULL)
{
fputs(buffer,s_fp);
++lenth;
}
rewind(s_fp);
fclose(t_fp);
if((fp=fopen(cc,"r"))==NULL)
{
printf("Can't open the file %s\n",cc);
exit(0);
}
if((fp1=fopen(dd,"w+"))==NULL)
{
printf("Can't open the file %s\n",dd);
exit(0);
}
len=strlen(cc);
if((fp=fopen(dd,"r"))==NULL)
{
printf("Can't open the file %s\n",dd);
exit(0);
}
if((fp1=fopen(ee,"w+"))==NULL)
{
printf("Can't open the file %s\n",ee);
exit(0);
}