READNODE.C
资源名称:C.rar [点击查看]
上传用户:qq5388545
上传日期:2022-07-04
资源大小:29849k
文件大小:1k
源码类别:
界面编程
开发平台:
C/C++
- #include "stdio.h"
- #define MAX 10000
- void main()
- {
- FILE *fp1,*fp2;
- float ver;
- int nodenum,t[14],i,j;
- char s1[80],s2[80];
- float nodex[MAX],nodey[MAX],nodez[MAX];
- printf("Please enter data filename:");
- gets(s1);
- if((fp1=fopen(s1,"r"))==NULL){
- printf("tnCannot 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);
- for(i=0;i<=6;i++)
- fscanf(fp1,"%d",&t[i]);
- fscanf(fp1,"%f%f%f",&nodex[0],&nodey[0],&nodez[0]);
- fscanf(fp1,"%d%f%d%d",&t[0],&ver,&t[1],&t[2]);
- for(j=1;j<=nodenum-1;j++)
- {
- for(i=0;i<=6;i++)
- fscanf(fp1,"%d",&t[i]);
- {
- fscanf(fp1,"%f%f%f",&nodex[j],&nodey[j],&nodez[j]);
- fscanf(fp1,"%d%f",&t[0],&ver);
- }
- }
- printf("Please input savedata filename:");
- gets(s2);
- if((fp2=fopen(s2,"w"))==NULL){
- printf("tnCannot open the file!n");
- exit(1);
- }
- printf("nSaving datas......n");
- for(j=0;j<=nodenum-1;j++)
- fprintf(fp2,"%e %e %en",nodex[j],nodey[j],nodez[j]);
- printf("nntaProgram is over!n");
- printf("t******************n");
- }