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[])
- {
- //Decralation of variables
- FILE *fpi,*fpo;
- int id;
- int points[3];
- int num=4918545;
- //Open CSV file
- if((fpi=fopen(argv[1],"r"))==NULL)
- {
- printf ("The file can't be opened. The program is exit.\n");
- return 0;
- }
- //Open VTK file for save
- if((fpo=fopen(argv[2],"w"))==NULL)
- {
- printf("The file can't be opened. The program is exit.\n");
- return 0;
- }
- //points=(float *)malloc(num*3*sizeof(float));
- //fread((float *)points,sizeof(float),1,fpi);
- while(fscanf(fpi,"%d%d%d%d",&id,&points[0],&points[1],&points[2])!=EOF)
- {
- //printf("%3.0d%3.0d%3.0d\n",points[0],points[1],points[2]);
- fprintf(fpo,"%7.0d%7.0d%7.0d\n",points[0],points[1],points[2]);
- //fwrite(&points,sizeof(int),3,fpo);
- //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