本文介绍了如何使用Boost库更改文件权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 如何使用Boost库将文件的权限更改为只读?How can I use the Boost library to change the permissions of a file to read-only?我已经看到了一些问题,例如 this 和这,但我还是不知道如何做到,我已经尝试过There are some questions that I have already seen, such as this and this, but I still don't know how to do it, I have tried doingboost::filesystem::wpath path = L"abc.txt";if( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ){ boost::filesystem::file_status s = boost::filesystem::status( path ); /* here I need to set file permissitons to READ ONLY for `path` file */}任何想法?推荐答案#include <boost/filesystem.hpp>int main(){ using namespace boost::filesystem; wpath path = L"abc.txt"; permissions(path, others_read|owner_read);} 这篇关于如何使用Boost库更改文件权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-01 15:54