Download MetaTrader 5

How to use DeleteFileA function

To add comments, please log in or register
Eric
7
Eric  

Hi 

I need help to figure out what is wrong with my codes like to delete a file and figure out the path.

#import "kernel32.dll"

   int CopyFileA(string lpExistingFileName,string lpNewFileName, bool bFailIfExists);

   int DeleteFileA(string lpFileName);

#import 

... 

...

   DeleteFileA(D:\\temp\\test.txt");

I have a file in D:\temp\test.txt but the program don't seem to work .

Where did I go wrong?

DeleteFileA(TerminalPath()+"\\MQL4\\files\\test.txt");

I have a file named test.txt in the working folder but same problem, the delete function not working. 

 

Thanks.  

Carl Schreiber
7109
Carl Schreiber  
You have to use Windows' ..W(..) like CopyFileW(), DeleteFileW(), ...
Eric
7
Eric  

Gooly 

I have got it working d. Thanks a million! 

To add comments, please log in or register