다음을 통해 공유


SetFileAttributes (Windows CE 5.0)

Send Feedback

This function sets the attributes of a file. A RAPI version of this function exists, called CeSetFileAttributes (RAPI).

BOOLSetFileAttributes(LPCTSTRlpFileName, DWORDdwFileAttributes);

Parameters

  • lpFileName
    [in] Pointer to a string that specifies the name of the file whose attributes are to be set.

    There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the SetFileAttributes function parses paths.

  • dwFileAttributes
    [in] File attributes to set for the file. This parameter can be a combination of values. However, all other values override FILE_ATTRIBUTE_NORMAL. The following table shows the possible values for dwFileAttributes.

    Value Description
    FILE_ATTRIBUTE_ARCHIVE Indicates that the file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.
    FILE_ATTRIBUTE_HIDDEN Indicates that the file is hidden. Hidden files and directories are not included in a typical directory listing.
    FILE_ATTRIBUTE_NORMAL Indicates that the file has no other attributes set. This attribute is valid only if used alone.
    FILE_ATTRIBUTE_READONLY Indicates that the file is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it.
    FILE_ATTRIBUTE_SYSTEM Indicates that the file or directory is part of, or is used exclusively by, the OS.
    FILE_ATTRIBUTE_TEMPORARY Indicates that the file is being used for temporary storage. File systems attempt to keep all the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The SetFileAttributes function does not work on the ROM file system. Inherently, this call is dependent on the file system support provided by a file system driver.

The FILE_ATTRIBUTE_DIRECTORY attribute cannot be set using SetFileAttributes. CreateFile and SetFileAttributes cannot be used to create directories. To create a directory, use the CreateDirectory function.

Not all file systems support all attributes.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

See Also

CeSetFileAttributes (RAPI) | CreateDirectory | GetFileAttributes | GetFileAttributesEx

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.