GetFileAttributes

  DWORD GetFileAttributes(lpszFileName)    
  LPTSTR lpszFileName; /* name of the file */

The GetFileAttributes function returns attributes for the specified file.

Parameters

lpszFileName

Points to a null-terminated string that specifies the name of the file to return attributes for.

Return Value

If the function is successful, is the attributes of the specified file. The attributes may be a combination of the following values:

Attribute Description

FILE_ATTRIBUTE_ARCHIVE The file is marked as archive.
FILE_ATTRIBUTE_DIRECTORY The file is marked as a directory.
FILE_ATTRIBUTE_HIDDEN The file is marked as hidden.
FILE_ATTRIBUTE_NORMAL The file has no other attributes set.
FILE_ATTRIBUTE_READONLY The file is marked as read-only.
FILE_ATTRIBUTE_SYSTEM The file is marked as a system file.
FILE_ATTRIBUTE_VOLUME_LABEL The file is marked as a volume label.

If an error occurs, the return value is -1 (0xFFFFFFFF). Use the GetLastError function to obtain extended error information.

Comments

The GetFileAttributes 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

SetFileAttributes, FindFirstFile, FindNextFile