next up previous contents
Next: acos Up: リファレンスマニュアル Previous: abs

  
access

【目的】
access - ファイルのアクセス権を調べる
【形式】
i = access(file,mode)      i = access(file)
    Integer i;                 Integer i;
    String file,mode;         String file;
【詳細】
access(file, mode) は file のアクセス権を調べる。 アクセス権がある場合,0(整数)が返され,アクセス権がない場合, 0 (整数)以外の値が返される。mode には調べたいアクセス権を 文字列を組み合わせて指定する。指定できる文字列を以下に示す。
"f" : ファイルが存在するか
"x" : ファイルを実行できるか
"w" : ファイルに書き込めるか
"r" : ファイルを読み込めるか
mode が省略された場合,読み込みに関するアクセス権が調べられる。
【例題】
次の例では,ファイル "afo.mm" に関するアクセス権を調べる。
  i = access("afo.mm", "f");
  if (i == 0) {
    print "afo.mm exists.";
  } else {
    print "afo.mm doesn't exist.";
  }
  i = access("afo.mm", "w");
  if (i == 0) {
    print "afo.mm can be changed";
  } else {
    print "afo.mm cann't be changed.";
  }
【参照】
fopen(2.75)


Masanobu KOGA 平成11年10月2日