# SetFileAttrs

int SetFileAttrs (char fileName[], int readOnly, int system, int hidden, int archive);

## Purpose

Sets the readOnly, system, hidden, and archive attributes of a file.

Linux This function is not supported.

The readOnly attribute prevents a file from being overwritten and prevents a file with the same name from being created.

The system attribute and hidden attribute prevent the file from appearing in a directory list and exclude the file from normal searches.

The archive attribute is set whenever the file is modified. The DOS backup command clears the archive attribute.

## Parameters

Input
Name | Type | Description
fileName | string | The pathname of the file for which to get the attributes. If you specify an empty string "", SetFileAttrs uses the file found by the most recent call to GetFirstFile or GetNextFile.
readOnly | integer | The state of the readOnly attribute. Values 1—Sets the attribute. 0—Clears the attribute. -1—Leaves the attribute unchanged.
system | integer | The state of the system attribute. Values 1—Sets the attribute. 0—Clears the attribute. -1—Leaves the attribute unchanged.
hidden | integer | The state of the hidden attribute. Values 1—Sets the attribute. 0—Clears the attribute. -1—Leaves the attribute unchanged.
archive | integer | The state of the archive attribute. Values 1—Sets the attribute. 0—Clears the attribute. -1—Leaves the attribute unchanged.

## Return Value

Name | Type | Description
result | integer | The result of the call.
Code | Description
0 | Success.
-1 | File not found, or attribute cannot be changed.