Like,
cout<<Type in the file to delete: ";
cin>>filepath;
???
Printable View
Like,
cout<<Type in the file to delete: ";
cin>>filepath;
???
Use the remove or unlink functions.
Could you please type in the code for that? I can't figure it out.
Code:#include <stdio.h>
/* ... */
remove("autoexec.bat");
Or this:
Code:BOOL DeleteFile(
LPCTSTR lpFileName // pointer to name of file to delete
);
DeleteFile(filename);
That's Windows only ;)
Ok, thanks, I was trying to figure it out in windows but I couldn't do it. Thanks.
can you delete any file with that? like even protected system files? And one more thing, if you used that, would a virus scanner pick it up?
I am not going to write a virus, just wondering how it works.
Yeah, like remove(some important files), will a virus scanner find it? I was wondering, because it is so simple.
I don't really know how a virus scanner works, but I am guessing that it monitors only the most important system files. If it monitored every single file, then it would slow the system down considerably. It probably won't do anything if you directly edit them with a text editor or something, but it might pop up if you change them through code. You could try it yourself, but be sure to make a backup of the one you are editing!
yeah, well if you just did a full system scan, would it be able to pick up anything?
I cant get it to work....
remove("jim.zip");
It no workie:confused: :confused: :mad:
Gah, I spoke too soon. I forgot I had to put remove("C:\\Windows\\Desktop\\f-er.zip");
I was putting:
remove("C:\Windows\Desktop\f-er.zip")
:D :D :D :D :D :rolleyes: :rolleyes: :rolleyes: