System.SysUtils.FileSetAttr
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);
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
説明
指定したファイルのファイル属性を設定します。
FileSetAttr は、FileName で指定したファイルのファイル属性を Attr で指定した値に設定します。 Attr の値は、次に示すように、適切なファイル属性定数を組み合わせて作成します。
Delphi の場合:
FileSetAttr('MyFile.sys', SysUtils.faReadOnly or SysUtils.faSysFile, True);
C++ の場合:
FileSetAttr("MyFile.sys", faReadOnly | faSysFile, true);
FileSetAttr は、処理が成功すれば 0 を返します。 成功しなければエラー コードを返します。
メモ: 指定された FileName パラメータが シンボリック リンク であり、FollowLink パラメータが True に設定されている場合、このメソッドは対象ファイルに対して実行されます。 最初の条件が True だが FollowLink パラメータが False に設定されている場合、メソッドはシンボリック リンクに対して実行されます。
メモ: FileSetAttr は、Windows でのみ利用できます。
関連項目