Delphi FileGetAttr - 返回文件名的文件属性。

Delphi FileGetAttr - 返回文件名的文件属性。

单元:SysUtils

原型:

function FileGetAttr(const FileName: string): Integer;
begin
  Result := GetFileAttributes(PChar(FileName));
end;

FileGetAttr 以位字符串的形式返回文件的属性。此值与TSearchRec类型的Attr字段相同。使用以下代码检查单个属性:

Attrs := FileGetAttr('Test.sys');

if Attrs and faHidden <> 0 then
  FileSetAttr('Test.sys', Attrs &!faHidden);

返回值-1表示发生了错误。  

注意:FileGetAttr 仅适用于Windows。

 

更多参考:GetFileAttributes  

更多参考:TSearchRec

 

 

 

创建时间:2022.02.16  更新时间:

posted on 2022-02-16 11:44  滔Roy  阅读(210)  评论(0编辑  收藏  举报

导航