Is there a way to change the attribute of a file from read-only to read-write using the boost filesystem library? If not, what is the next-best way to do this on Windows (using Microsoft's C++)?
I didn't find how to do that in the boost library. But you can do it using Windows API:
SetFileAttributes(lpFileName, GetFileAttributes(lpFileName) & ~FILE_ATTRIBUTE_READONLY);
See SetFileAttributes Function and GetFileAttributes Function for more info.
The following worked with Boost 1.55 on Windows:
permissions(file_path, add_perms|owner_write|group_write|others_write);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With