Write to CSV files, how to pick line/column?

 

Does anyone know how you can choose the location on which you write in a CSV file? I only know how to write at the very beginning or end of a file. Plus only in the first column.

I'm using this piece of code:

 

void WriteNewEntry(string Name, string Message ){
   int handle=FileOpen( Name , FILE_CSV|FILE_READ|FILE_WRITE, ',');
   if(handle>0){
      FileSeek(handle, 0, SEEK_END);
      FileWrite(handle, Message);
      FileClose(handle); 
   }
}
 
ForexAlpha:

Does anyone know how you can choose the location on which you write in a CSV file? I only know how to write at the very beginning or end of a file. Plus only in the first column.

I'm using this piece of code:

 

 

 

The most straightforward method, especially when the file records are not of fixed length, is to -

1) Create an array by iterating through the file.

2) Choose the location by iterating through the array 

3) Perform whatever you wish on the location within the array

4) If you desire - delete the file and rewrite from the data within the array. 

Reason: