Testing if a file/directory is read only

后端 未结 2 1005
眼角桃花
眼角桃花 2021-01-24 15:50

okay, so I\'m a bit of a C newbie. How does one test whether a file is read only on windows.

I tried to get something working with the GetFileAttributes function, but to

2条回答
  •  被撕碎了的回忆
    2021-01-24 16:39

    You are forgetting about the ACL. A file can have it's read-only bit clear but still have a restrictive ACL. You can call CreateFile and check the return code. Or call `AuthzAccessCheck'.

提交回复
热议问题