如何在 C++ 中获得管理员权限?

问题描述 投票:0回答:0

我需要更改文件的权限。我试过权限功能。但我无法获得它,因为文件的安全属性不允许它。

permissions("hello_m.txt",perms::owner_all | perms::group_all, perm_options::add);

这是结果:

terminate called after throwing an instance of 'std::filesystem::\__cxx11::filesystem_error'
what():  filesystem error: cannot set permissions: Permission denied \[hello_m.txt\]
c++ c++17 filesystems
© www.soinside.com 2019 - 2024. All rights reserved.