Download MetaTrader 5
To add comments, please log in or register
Have you found an interesting application? Publish it in Code Base - millions of traders will appreciate that!
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
274
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