Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在根目录中有一个文件,我想在我的 QT 应用程序中打开它进行编辑。通常我们使用 sudo filepath 以所有权限打开文件。但我想在我的 c++ QT 应用程序中实现这一点。任何形式的帮助都是可观的。谢谢你。
您的程序需要以 root 权限执行,或者更具体地说,它需要以对这些文件具有访问权限的用户身份执行。
如果不是,则无法访问这些文件,因为操作系统不允许您的程序这样做。C++ 代码中没有可以解决此问题的更改。您需要使用sudo.
sudo
请执行下列操作。