SetFileAttributes

  BOOL SetFileAttributes(lpFileName, dwFileAttributes)    
  LPTSTR lpFileName; /* points to filename */
  DWORD dwFileAttributes; /* attrs to set */

The SetFileAttributes function sets a file's attributes.

Parameters:

lpFileName

Points to a null-terminated string that specifies the name of the file whose attributes are to be set.

dwFileAttributes

Specifies the file attributes to set for the file. Any combination of flags is acceptable except that all other flags override the normal file attribute, FILE_ATTRIBUTE_NORMAL.

Attribute Meaning

FILE_ATTRIBUTE_ARCHIVE  
  File is marked as archive.
FILE_ATTRIBUTE_NORMAL  
  File can be read from or written to.
FILE_ATTRIBUTE_READONLY  
  File is read only.
FILE_ATTRIBUTE_HIDDEN  
  File is a hidden file.
FILE_ATTRIBUTE_SYSTEM  
  File is a system file.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

The SetFileAttributes function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

GetFileAttributes