Previous: 4.24.2.17. GetEnv To the Table of Contents Next: 4.24.2.19. GetFTime
4.24.2.17. GetEnv Table of Contents 4.24.2.19. GetFTime

- 4.24.2.18. -
Table of Contents
4. Standard Units
4.24. DOS - MSDOS support unit
4.24.2. DOS Unit Procedures and Functions
4.24.2.18. GetFAttr


4.24.2.18. GetFAttr

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: 4.24.2.17. GetEnv To the Table of Contents Next: 4.24.2.19. GetFTime
4.24.2.17. GetEnv Table of Contents 4.24.2.19. GetFTime

- 4.24.2.18. -