Previous: GetEnv function To the Table of Content Next: GetFTime procedure

- 4.24.2.18 -
Standard Units
Dos Unit
Dos Unit Procedures and Functions

GetFAttr procedure

Targets: MS-DOS, OS/2, Win32


Dos Unit, WinDos Unit

Returns the attributes of a file.

Declaration:
procedure GetFAttr(var F; var Attr: Word);
Remarks:
F is a file variable, either typed, untyped, or text file that is not open. Attr contains the file attributes.

The file associated with F must be closed. Attr should be examined by ANDing it with the file attribute constants, which are defined in the Dos unit.

Errors are reported in DosError, a variable defined in the Dos unit. For more information about file attributes consult your DOS reference manual.

Example:
uses
  Dos;
var
  Fi  : Text;
  Attr: Word;
begin
  Assign(Fi,'THEFILE.DOC');
  GetFAttr(Fi, Attr);
  if (Attr and ReadOnly) <> 0 then
    SetFAttr(Fi,(Attr xor ReadOnly));
end.
See also:
SetFAttr


Previous: GetEnv function To the Table of Content Next: GetFTime procedure
GetEnv function Table of Content GetFTime procedure

- 4.24.2.18 -