Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc,char*argv[])
- {
- FILE *fpi,*fpo;
- int i,j,height,width,r_height;
- float data;
- char line[9];
- if(argc!=5)
- {
- fprintf(stderr,"Usage: %s 5m_mesh_data.lem,5m_mesh_data.raw\n",argv[0]);
- exit(1);
- }
- printf("OPEN FILE NAME:%s\n",argv[1]);
- if((fpi=fopen(argv[1],"r"))==NULL)
- {
- fprintf(stderr,"5mïWçÇÉfÅ[É^ÉtÉ@ÉCÉãñº.lem\n");
- exit(1);
- }
- if((fpo=fopen(argv[2],"wb"))==NULL)
- {
- fprintf(stderr,"5mïWçÇÉfÅ[É^ÉtÉ@ÉCÉã.raw\n");
- exit(1);
- }
- height=atoi(argv[3]);
- width=atoi(argv[4]);
- r_height=height※width/10;
- for(i=0;i<r_height;i++)
- {
- fseek(fpi,i*82,SEEK_SET);
- for (j=0;j<10;j++)
- {
- fseek(fpi,8*j+i*82,SEEK_SET);
- fgets(line, 9, fpi);
- data=atof(line);
- // printf("%f\n",data);
- fwrite(&data,sizeof(float),1,fpo);
- }
- }
- fclose(fpi);
- fclose(fpo);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement