Annoying problem

I made a file called DeleteMe and now I'm trying to use c++ to find the program and delete it.

I have tried everything I can think of but I don't think I'm typing the path correctly or something. I went to the folder where it is located and simply copied the address.

Anyone have any insight?

 
 DeleteFile("C:\Program Files\DeleteMe");
The \ are being seen as an escape sequence, either use \\ or /.
http://en.cppreference.com/w/cpp/language/escape
Last edited on
 
DeleteFile("C:\\Program Files\\DeleteMe");


Didn't work either though. Is there something else I'm screwing up with the path? I copied and pasted it.

What type of file is it? DeleteMe should normally have some type of extension you need to include there.

How are you checking it is not found?
I made an empty folder and didn't do anything else to it. I placed it inside my program files. That is it.
if it is a regular text document extension is .txt
Anyone else know?

It's just an empty brand new folder I named DeleteMe.

I put it in the mycomputer>C drive>program files
Assuming DeleteFile is the windows function to delete files. DeleteFile is only used to (wait for it) delete files, not folders. To delete a(n empty) directory (folder) use RemoveDirectory http://msdn.microsoft.com/en-us/library/windows/desktop/aa365488(v=vs.85).aspx
Thanks Lachlan.
Topic archived. No new replies allowed.