Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a file using Visual C++?

Tags:

visual-c++

I want to delete file from my program. Trying to use this function but still fail;

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

What is the correct way?

like image 735
karikari Avatar asked Jan 18 '11 08:01

karikari


2 Answers

Escape the \;

DeleteFile(L"c:\\c.png");
like image 78
ismail Avatar answered Sep 24 '22 07:09

ismail


DeleteFile works.

Try,

DeleteFile("c:\\\c.png"); // 2 slashes.
like image 27
ckv Avatar answered Sep 25 '22 07:09

ckv