www.pudn.com > c.rar > REA15000.C, change:1997-08-10,size:1729b


#include "stdio.h" 
#define MAX 15000 
main() 
{ 
FILE *fp1,*fp2; 
float ver[50]; 
int nodenum,t[14],i,j,k; 
int num_node[4]; 
char s1[80],s2[80]; 
float nodex[MAX],nodey,nodez; 
int *p1; 
float *px; 
px=nodex; 
printf("Please enter data filename:"); 
gets(s1); 
if((fp1=fopen(s1,"r"))==NULL){ 
	printf("\t\nCannot open the file or file not find!\n"); 
	exit(1); 
	} 
printf("Reading datas......\n"); 
fseek(fp1,23L,0); 
fscanf(fp1,"%d",&nodenum); 
for(i=0;i<=13;i++) 
fscanf(fp1,"%d",&t[i]); 
fscanf(fp1,"%f",&ver[0]); 
for(i=0;i<=6;i++) 
fscanf(fp1,"%d",&t[i]); 
printf("Please input savedata filename:"); 
gets(s2); 
if((fp2=fopen(s2,"w"))==NULL){ 
	printf("\t\nCannot open the file!\n"); 
	exit(1); 
	} 
printf("\nSaving datas......\n"); 
fscanf(fp1,"%f%f%f",&px[0],&nodey,&nodez); 
fprintf(fp2,"%e\t%e\t%e\n",px[0],nodey,nodez); 
fscanf(fp1,"%d%f%d%d",&t[0],&ver[0],&t[1],&t[2]); 
for(j=1;j<=nodenum-1;j++) 
{ 
for(i=0;i<=6;i++) 
fscanf(fp1,"%d",&t[i]); 
	{ 
	  for(k=0;k<=2;k++) 
	  {fscanf(fp1,"%f",&px[j]); 
	  fprintf(fp2,"%e\t",px[j]); 
	  if(k==2)fprintf(fp2,"\n"); 
	  } 
	  fscanf(fp1,"%d%f",&t[0],&ver[0]); 
	  } 
} 
 
fprintf(fp2,"****************************\n"); 
for(i=0;i<=7;i++) 
fscanf(fp1,"%d",&t[i]); 
for(i=0;i<=33;i++) 
fscanf(fp1,"%f",&ver[i]); 
fprintf(fp2,"NUM\tI\tJ\tK\tL\n"); 
for(i=0;i<=t[1]-1;i++) 
{ 
p1=num_node; 
fscanf(fp1,"%d",&t[4]); 
fprintf(fp2,"%d\t",t[4]); 
for(j=0;j<=3;j++) 
	{ 
	 fscanf(fp1,"%d",&p1[j]); 
	 fprintf(fp2,"%d\t",p1[j]); 
	 if(j==3)fprintf(fp2,"\n"); 
	} 
fscanf(fp1,"%d%f%f%d%d%f",&t[2],&ver[0],&ver[1],&t[3],&t[4],&ver[2]); 
if(kbhit())if(getch()==27)break; 
} 
printf("\n\n\t\aProgram is over!\n"); 
printf("\t******************\n"); 
fclose(fp1); 
fclose(fp2); 
}