How to get file permissions with c++ boost library?

前端 未结 2 537
我在风中等你
我在风中等你 2021-01-18 14:50

I am working on a project to make a database of the files I have on current directory. And one of the details I want about my files is the file permissions that are set with

2条回答
  •  猫巷女王i
    2021-01-18 15:14

    perms      permissions() const                { return m_perms; } 
    

    defined in boost/filesystem/v3/operations.hpp

    Add an easy sample code

    #include  
    #include  
    namespace fs=boost::filesystem;
    int main(int argc,char * argv[]){
        fs::path p(argv[1]);
        fs::file_status s = status(p);
        printf("%o\n",s.permissions());
    }
    

提交回复
热议问题