Previous: SetDate procedure To the Table of Content Next: SetFTime procedure

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

SetFAttr procedure

Targets: MS-DOS, OS/2, Win32


Dos Unit, WinDos Unit

Sets the attributes of a file.

Declaration:
procedure SetFAttr(var F; Attr: Word);
Remarks:
The file associated with F must be closed. Attr should be formed by ORing 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.

Win32 target:
The file handle must have been created with GENERIC_WRITE access.

Example:
uses
  Dos;
var
  Fi  : File;
  Attr: Word;
begin
  Assign(Fi, 'SECRET.DOC');
  Attr := Hidden or ReadOnly;
  SetFAttr(Fi, Attr);
  WriteLn('SECRET.DOC is now hidden.');
end.
See also:
GetFAttr


Previous: SetDate procedure To the Table of Content Next: SetFTime procedure
SetDate procedure Table of Content SetFTime procedure

- 4.24.2.29 -