How to delete a file using Visual C ++?

I want to delete a file from my program. Trying to use this function, but still not working;

#include<stdio.h> DeleteFile(L"c:\c.png"); 

What is the right way?

+6
visual-c ++
source share
3 answers

Escape \ ;

 DeleteFile(L"c:\\c.png"); 
+8
source share

DeleteFile works.

Try

 DeleteFile("c:\\\c.png"); // 2 slashes. 
+2
source share

I decided! I forgot the double backslash :)

 DeleteFile(L"c:\\c"); 
0
source share

All Articles