Question about writing .csv

 

Hello,experts


Lets say I have too many integer in array.

int a[];

and ArraySize of A has more than 50+;


If I want to put these numbers to .csv and sort by column.


So how to input parameter in FileWrite() easily?

 FileWrite(filehandle,a[0],a[1],a[2],a[3],a[4],............,a[50]);

by using any for/while loop.


Thank you very much

 
Kittamet Sirinyamas: by using any for/while loop.

Create a string and write that.

string out="", separator=",";
for(int i=0; i < n; ++i){
  if(i!=0) out=out+separator;
  out=out+stringFormat("%g", a[i]);
}
FileWrite(filehandle,out);
 
William Roeder #:

Create a string and write that.

Thank you very much