Cannot write .csv file to StringGrid in C++ Builder -
edit: codeblock edited, problem last line of .csv file printed in each row of stringgrid. can reason? in advance.
basically , 1 module of project create output file toushands of point coordinates in comma seperated format shown below :
#pt, x , y ,z 124,4500003.833,3499999.500,0 125,4500003.833,3499999.833,0 126,4500003.833,3500000.167,0
what i'm trying reading .csv module , put stringgrid.
file *coord; //some other things here while (fgets(line,100,dosyagiris)!=null) { sscanf(line,"%d,%lf,%lf,%lf",&number,&x,&y,&z); (col = 0; col < 4; col++) { stringgrid1->cells[0][row] = inttostr(number); stringgrid1->cells[1][row] = floattostr(x); stringgrid1->cells[2][row] = floattostr(y); stringgrid1->cells[3][row] = floattostr(z); } }
please constructive , have one.
it not working because of unnecessary loop, works.
int i= 0; while (fgets(line,100,dosyagiris)!=null){ sscanf(line,"%d,%lf,%lf,%lf",&id,&x,&y,&z); stringgrid1->cells[0][i+1] = inttostr(id); stringgrid1->cells[1][i+1] = floattostr(x); stringgrid1->cells[2][i+1] = floattostr(y); stringgrid1->cells[3][i+1] = floattostr(z); i++; }
Comments
Post a Comment