Delete from file

 

How can you delete from a file ? 

Do i retain the cursor position and rewrite from there if a change is needed ? 

 
Lorentzos Roussos: How can you delete from a file? Do i retain the cursor position and rewrite from there if a change is needed ? 

Yes, you overwrite based on a saved seek position. The MQL file functions, don't offer a function for reducing the file size, so files can only grow, never shrink.

To reduce the file size, you would need to read all the data in, and then create a new file and delete the original file.

 
Fernando Carreiro #:

Yes, you overwrite based on a saved seek position. The MQL file functions, don't offer a function for reducing the file size, so files can only grow, never shrink.

To reduce the file size, you would need to read all the data in, and then create a new file and delete the original file.

Then a full rewrite is preferrable i guess . Thanks