GetFileAttrs
int GetFileAttrs (char fileName[], int *readOnly, int *system, int *hidden, int *archive);
Purpose
Gets the readOnly, system, hidden, and archive attributes of a file.
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.
If you pass a directory instead of a file, GetFileAttrs returns 1.
![]() |
Note If you do not set any of the attributes, the file is a normal file and can be read or written without restriction. |
Example Code
/* Get the attributes of WAVEFORM.DAT. */
int read_only, system, hidden, archive;
GetFileAttrs ("WAVEFORM.DAT",&read_only, &system, &hidden, &archive);
if (read_only)
FmtOut ("WAVEFORM.DAT is a read-only file!");
Parameters
Input | ||
Name | Type | Description |
fileName | char [] | The pathname of the file for which to get the attributes. If you specify an empty string "", GetFileAttrs uses the file found by the most recent call to GetFirstFile or GetNextFile. |
Output | ||
Name | Type | Description |
readOnly | int | The state of the readOnly attribute. Values 1—Attribute set. 0—Attribute cleared. |
system | int | The state of the system attribute. Values 1—Attribute set. 0—Attribute cleared. |
hidden | int | The state of the hidden attribute. Values 1—Attribute set. 0—Attribute cleared. |
archive | int | The state of the archive attribute. Values 1—Attribute set. 0—Attribute cleared. |
Return Value
Name | Type | Description | ||||||||
result | int | The result of the call.
|
Additional Information
Library: Utility Library
Include file: utility.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later