Download MetaTrader 5
To add comments, please log in or register
1000 paid orders are executed in Freelance service. Sign up!
Forex Alpha
33
Forex Alpha 2014.12.24 20:15 

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); 
   }
}
rod178
276
rod178 2014.12.25 11:37  
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. 

/
To add comments, please log in or register