Open the file for read/write.
phy:
Open the file for read/write.
Open the file for read/write.
Thanks for you rely, but I still didn't understand. Could you explain in detail to me, please?
Read carefully:
https://docs.mql4.com/files/FileOpen
Also, you complain about GetLastError().
Read carefully:
Thanks a lot. Both of them are working properly now.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I wanted to keep error logs in a file, but the programme overwrote the previous logs and there was always one line. In the documentation, the example says that using SEEK_END can move to the next line and keep writing, but it didn't work for me. Also, sometimes when I opened the file and it showed "0: no error". I thought the IF statement would keep "0: no error" away from the log.
Is there any wrong with my code? Thanks for your help.
if(GetLastError() != 0)
{
int EA_Error_Handle = FileOpen(EA_Error_File,FILE_WRITE,";");
FileSeek(EA_Error_Handle,0,SEEK_END);
FileWrite(EA_Error_Handle,GetLastError() + ": " + ErrorDescription(GetLastError()));
FileClose(EA_Error_Handle);
}