Reputation: 670
In my MFC application I have set the read only attribute on a particular file.
I have done this by using the SetFileAttributes()
function.
At some point I have to remove that attribute of that file again.
Can anyone explain how to do this?
Upvotes: 12
Views: 13095
Reputation: 21898
Use SetFileAttributes
again to reset the flag:
SetFileAttributes( pszFilename,
GetFileAttributes(pszFilename) & ~FILE_ATTRIBUTE_READONLY);
Might be worth adding that this method returns 0
if the function fails and you can use GetLastError()
.
Upvotes: 28