System.SysUtils.FileSystemAttributes

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

function FileSystemAttributes(const Path: string): TFileSystemAttributes;

C++

extern DELPHI_PACKAGE TFileSystemAttributes __fastcall FileSystemAttributes(const System::UnicodeString Path);

プロパティ

種類 可視性 ソース ユニット
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

説明

ファイル システムの属性を返します。

FileSystemAttributes は、パス名で指定されたファイル システムの属性を返します。FileSystemAttributes は、指定されたパスからドライブ識別子を抜き出し、そのドライブにあるファイル システムの属性を返します。指定されたパスが無効であれば、例外が送出されます。

たとえば、ドライブ X がリムーバブル(取り外し可能)かどうかを確かめるには、X の有効なパス名を引数に渡してこの関数を呼び出します。Delphi の場合は、以下のようなコードになります。

 FileSysAttr := FileSystemAttributes('X:\');
   if fsRemovable in FileSysAttr then
     Writeln('Drive X is removable');

関連項目