Granting permission/ deleting files which need admin permission

269 views Asked by At

I have recently started coding C++ and I am wondering how I can delete a file/grant user sufficient permission to delete a file. For instance, deleting a windows file.(Wanting to know for educational purposes)

I have tried DeleteFile() and std::remove, but whenever running such code, all I get is "Access denied". Is there any (easy) ways to force delete such files even though my account is classified as "Administrator"?

DeleteFile("filepath");
std::remove("filepath");

Code meant for windows 7 and upwards

0

There are 0 answers