Download MetaTrader 5

FileFindNext() crashes the EA with an access violation

To add comments, please log in or register
Doerk Hilger
1188
Doerk Hilger  

Hey there, 

this code crashes the EA with the message: Access violation write to 0x00000020 in '(...)EA.ex4'. WTF?

string filename=NULL;
string search="*";
long handle=FileFindFirst(search,filename,FILE_COMMON);

while (handle!=INVALID_HANDLE)
      {
      handle=FileFindNext(handle,filename);
      }
FileFindClose(handle);   

When FileFindNext() is executed 3rd time, the debugger stops. It happens with every search mask. I cannot trace the problem. 

Of course I reported this to the service desk, but my last answer there is 3 months ago. Senseless in most cases. Maybe someone had the same problem and has an idea. 

Thanks in advance

Doerk 

Doerk Hilger
1188
Doerk Hilger  
My fault. FileFindNext() returns bool.
To add comments, please log in or register