How to use DeleteFileA function

 

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.  

 
You have to use Windows' ..W(..) like CopyFileW(), DeleteFileW(), ...
 

Gooly 

I have got it working d. Thanks a million! 

Reason: