klingej
asked on
changing read-only status of files copied from a CD
I have a program that is going to be using files that are going to be copied off CD. I need to be able to read/write to these files. Is there a way in MFC/Win32 to take off the "read-only" status of the files that are copied from the CD, so I can easily open them in CFile::modeReadWrite mode?
ASKER
I tried this code exactly, but it didn't work.. it ended up setting all the attributes because after the 2nd line, dwAttr was 0xffffffff (whereas, before, it was 0x00000021). Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Aahh.. makes sense.
Thanks!
Thanks!
// get file attributes
DWORD dwAttr = GetFileAttributes ( pszFileName);
// remove the readonly flag
dwAttr |= ~FILE_ATTRIBUTE_READONLY;
// set attributes
SetFileAttributes ( pszFileName, dwAttr);