Код: Выделить всё
#include
#include
bool MakeReadonly(const char* folderPath)
{
DWORD attrs = GetFileAttributesA(folderPath);
return SetFileAttributesA(folderPath, attrs | FILE_ATTRIBUTE_READONLY) != 0;
}
int main()
{
std::string folderPath = "C:\\Users\\Username\\Desktop\\mydir";
if (MakeReadonly(folderPath.c_str()))
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79400174/unable-to-make-folder-readonly[/url]