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

前端 未结 2 535
我在风中等你
我在风中等你 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条回答
  •  孤独总比滥情好
    2021-01-18 15:15

    File permissions example for windows:

    unsigned long attributes = ::GetFileAttributes( filePath.file_string().c_str());
    
    if ( attributes != 0xFFFFFFFF && ( attributes & FILE_ATTRIBUTE_READONLY ))
    {
        attributes &= ~FILE_ATTRIBUTE_READONLY;
        ::SetFileAttributes( filePath.file_string().c_str(), attributes );
    }
    

提交回复
热议问题