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;
- float x,y,z;
- int r,g,b;
- if(argc!=3)
- {
- 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,"Can not open\n");
- exit(1);
- }
- if((fpo=fopen(argv[2],"wb"))==NULL)
- {
- fprintf(stderr,"Can not open\n");
- exit(1);
- }
- while (fscanf(fpi,"%f %f %f %d %d %d",&x,&y,&z,&r,&g,&b)!= EOF)
- {
- printf("%f %f %f %d %d %d\n",x,y,z,r,g,b);
- fwrite(&x,sizeof(float), 1,fpo);
- fwrite(&y,sizeof(float),1,fpo);
- fwrite(&z,sizeof(float),1,fpo);
- }
- fclose(fpi);
- fclose(fpo);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement