set a file's attributes
BOOL SetFileAttributes( LPCSTR lpcszFilename, DWORD dwFileAttributes )
nonzero if it succeeds, 0 if it fails.
EX1
// This example shows how to change file attributes of a file. // Note that the file c:\myfile.txt must exist for this example to run. int SetFileAttributes_ex1() { string strFile = "c:\\myfile.txt"; if( !strFile.IsFile() ) return 0; // First get and display the old attributes: DWORD dwAttributes = GetFileAttributes(strFile); printf("File attributes are: %#x\n", dwAttributes); // remove read-only attributes if( dwAttributes & FILE_ATTRIBUTE_READONLY ) { dwAttributes &= ~FILE_ATTRIBUTE_READONLY; SetFileAttributes(strFile, dwAttributes); } return 1; }
It sets file attributes.
GetFileAttributes, GetFileAttributesEx
origin.h