meta data for this page
  •  

ibec_SetFileAttr

ibec_SetFileAttr sets the file attributes of the file specified by FileName to the value given by Attr.

Description

The value of Attr is formed by combining the appropriate file attribute constants:

 Constant     Value     Description
 -----------------------------------------------
 __faReadOnly $00000001 Read-only files
 __faHidden   $00000002 Hidden files
 __faSysFile  $00000004 System files
 __faVolumeID $00000008 Volume ID files
 __faDirectory$00000010 Directory files
 __faArchive  $00000020 Archive files
 __faAnyFile  $0000003F Any file

ibec_SetFileAttr returns zero if the function was successful. Otherwise the return value is a Windows error code.

This function now supports Unicode (UTF8) file names. You can still use ANSI names; necessary checks and conversion are performed automatically.

Syntax

  function ibec_SetFileAttr(FileName : string; Attr : integer) : integer;

Example

 FileAttr = ibec_FileAttr(TargetFileName);
 if (ibec_and(OldFileAttr, __faReadOnly) = __faReadOnly) then
   ibec_SetFileAttr(TargetFileName, ibec_xor(OldFileAttr, 
 __faReadOnly));