Advertisement
hasegawa

☆text2text-vtk-polygons2

Feb 6th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.08 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7.     //Decralation of variables
  8.     FILE *fpi,*fpo;
  9.     int id;
  10.     int points[3];
  11.    
  12.     int num=4918545;
  13.    
  14.     //Open CSV file
  15.     if((fpi=fopen(argv[1],"r"))==NULL)
  16.     {
  17.         printf ("The file can't be opened. The program is exit.\n");
  18.        
  19.         return 0;
  20.     }
  21.    
  22.     //Open VTK file for save
  23.     if((fpo=fopen(argv[2],"w"))==NULL)
  24.     {
  25.         printf("The file can't be opened. The program is exit.\n");
  26.        
  27.         return 0;
  28.     }
  29.    
  30.     //points=(float *)malloc(num*3*sizeof(float));
  31.     //fread((float *)points,sizeof(float),1,fpi);
  32.    
  33.    
  34.     while(fscanf(fpi,"%d%d%d%d",&id,&points[0],&points[1],&points[2])!=EOF)
  35.     {
  36.         //printf("%3.0d%3.0d%3.0d\n",points[0],points[1],points[2]);
  37.         fprintf(fpo,"%7.0d%7.0d%7.0d\n",points[0],points[1],points[2]);
  38.        
  39.         //fwrite(&points,sizeof(int),3,fpo);
  40.         //fwrite(&x,sizeof(float),1,fpo);
  41.         //fwrite(&y,sizeof(float),1,fpo);
  42.         //fwrite(&z,sizeof(float),1,fpo);
  43.     }
  44.    
  45.     fclose(fpi);
  46.     fclose(fpo);
  47.    
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement