mql4 How remove last line in a strings file

To add comments, please log in or register
Davide Tedesco
172
Davide Tedesco  

Hi at all,


in my EA framework i have implement a personal log service, that write a strings file.

This log service, write 2 line strings line at events that i specified it:

1 for infos, and last: "[server time] - last line logged".


In logical function of this log services, for every new line to log,

it set position of the file pointer in this way:

FileSeek([my int file_handle], -nn, SEEK_END);

(where, 'nn' is a number of char that i have calculate there are in string: "[server time] - last line logged",

and i know that it is not godd way, but now i don't have time for implement how program maybe calculate this number)

FileWriteString([my int file_handle], "\r\n");


In this way, it's all right... IF it write in file a line string with greater or equal number char of "[server time] - last line logged".


otherwise, if it log this "[server time] - a=55", this is result:

[server time] - begin log

[server time] - .... ... ... .... ... ....

[server time] - .... ... ... .... ... ....

[server time] - a=55line logged

[server time] - last line logged


There is a way for delete or erase last string line in mql4 ?


For this moment i stay try this way:

FileSeek([my int file_handle], -nn, SEEK_END);
FileWriteString([my int file_handle], "\r\n\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r");

but it a wrong workround...


very thanks at all

To add comments, please log in or register