Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(int argc, char *argv[])
- {
- //Decralation of variables
- FILE *fpi,*fpo;
- int ix,iy,a;
- float x,y,z,b,c,d;
- //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;
- }
- //count how many lines
- /*
- while((c=fgetc(fpi))!=EOF)
- {
- if(c=='\n')
- newline_count++;
- }
- */
- while(fscanf(fpi,"%d,%f,%f,%f",&a,&x,&y,&z)!=EOF)
- {
- ix=(int)((x+28000)-1);
- iy=(int)((-139500-y)-1);
- //printf("%d%d\n",ix,iy);
- fprintf(fpo,"%d %d %f %f %f\n",ix,iy,x,y,z);
- }
- fclose(fpi);
- fclose(fpo);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement