template<class character>
bool set_file_attributes(const character* file_name,
                         unsigned attributes)

This function sets the attributes of a file.


const character* file_name

The name of a file whose attributes are being set. Usually, the length of the file name may not exceed path_length::maximum. On some platforms, the wide version of this function may use names exceeding path_length::maximum by prefixing the characters "\\?\" to the full path name of the file.

unsigned attributes

The attributes of the file. The attributes (from enumeration file_attribute) that may be set are:

file_attribute::Readonly The file is read only.
file_attribute::hidden The file is hidden.
file_attribute::System The file is marked as a system file.
file_attribute::Archive The file has the archive bit set.
file_attribute::normal The file is a normal file.
file_attribute::Temporary The file is a temporary file.
file_attribute::Offline The file resides in offline storage.



true The function succeeded.
false The call failed.


A file's attributes may be queried via the function get_file_attributes.

The compressed attribute of a file may be set via the function device_input_output_control (using enumerator set_compression).