From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function FileSetAttr(const FileName: string; Attr: Integer; FollowLink: Boolean = True): Integer;


extern DELPHI_PACKAGE int __fastcall FileSetAttr(const System::UnicodeString FileName, int Attr, bool FollowLink = true);


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Sets the file attributes of a specified file.

FileSetAttr sets the file attributes of the file given by FileName to the value given by Attr. The value of Attr is formed by combining the appropriate file attribute constants, as in the following:

Object Pascal:

FileSetAttr('MyFile.sys', SysUtils.faReadOnly or SysUtils.faSysFile, True);


FileSetAttr("MyFile.sys", faReadOnly | faSysFile, true);

FileSetAttr returns zero if the function was successful. Otherwise the return value is an error code.

Note: If the specified file parameter is a symbolic link and the FollowLink parameter is set to True, the method is performed on the target file. If the first condition is True, but the FollowLink parameter is set to False, the method will be performed on the symbolic link.

Note: FileSetAttr is Windows only.

See Also

Code Examples