Show: Delphi C++
Display Preferences

System.SysUtils.FileSetAttr

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

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

Properties

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

Description

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:

Delphi:

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

C++:

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

Personal tools
In Other Languages
Previous Versions
Assistance