Testing if a file/directory is read only

后端 未结 2 1038
眼角桃花
眼角桃花 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:29

    GetFileAttributes is the correct Windows call - see MSDN example for use

    The example tests read only and the test is check dwAttrs & FILE_ATTRIBUTE_READONLY and that will be non zero if the file is read only.

提交回复
热议问题