FileOpen() returns error in debug mode but not with Stratergy Tester.
Use this code to find out error code:
int filehandle=FileOpen(filename,FILE_WRITE|FILE_CSV); if(filehandle<0) { Print("Failed to open the file by the absolute path "); Print("Error code ",GetLastError()); }
Above code is copied from the help for the FileOpen() function.
brad:
... with a message about how the file is in use by another program....
remember to close file every time after used.
FileClose(handle);
Hi there,
I run an EA in ST ok. It reads dates and times from a file in tester\files.
If I run the EA in debug mode, FileOpen() returns -1. It appears when using debug mode the EA looks for the file in MQL4\files because trying to open that file in debug mode displays a blank screen with a message about how the file is in use by another program.
Why does FileOpen() return -1 in debug mode but not encounter an error for this when run in ST?
I'm using MetaEditor v5.00 build 966.
Thanks.