Admin Production ni-theme
Current Publication

SetFileAttrs

LabWindows/CVI

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 sets only the readOnly parameter. Other parameters are ignored.

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 char [] 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 int The state of the readOnly attribute.

Values
1—Sets the attribute.
0—Clears the attribute.
-1—Leaves the attribute unchanged.
system int The state of the system attribute.

Values
1—Sets the attribute.
0—Clears the attribute.
-1—Leaves the attribute unchanged.
hidden int The state of the hidden attribute.

Values
1—Sets the attribute.
0—Clears the attribute.
-1—Leaves the attribute unchanged.
archive int 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 int The result of the call.

Code Description
0 Success.
-1 File not found, or attribute cannot be changed.

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later