Unit 'AmigaDOS' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#morphunits]

Examine64

Fill in a FileInfoBlock structure concerning a file or directory associated with a particular lock.

Declaration

Source position: amigados.pas line 2304

function Examine64(

  Lock: LongInt;

  Fib: PFileInfoBlock;

  Tags: Pointer

):LongInt;

Arguments

Lock

  

lock to examine

Fib

  

file info to recieve the data

Tags

  

tags, no tags defined for now

Function result

= 0 for error, otherwise success

Description

Fill in a FileInfoBlock structure concerning a file or directory associated with a particular lock. FileInfoBlock.fib_Size64 contains the size of the file. FileInfoBlock.fib_NumBlocks64 contains the number of blocks for the file.

If scanning a filesystem tree recursively, you'll need to allocated a new PFileInfoBlock for each directory level.

To examine a directory, do the following:

  1. Pass a lock on the directory and a PFileInfoBlock (allocated by AllocDosObject()) to Examine64().
  2. Pass the same parameters to ExNext64()).
  3. Do something with the PFileInfoBlock returned.
  4. Call ExNext64() repeatedly until it returns FALSE and use the information you are provided. When ExNext64 returns False, check IoErr() to make sure that there was no real failure (ERROR_NO_MORE_ENTRIES).

See also

Examine64

  

Fill in a FileInfoBlock structure concerning a file or directory associated with a particular lock.

AllocDosObject

  

Creates a dos object

ExAll

  

Examine an entire directory

IOErr

  

Return extra information from the system

ExamineFH64

  

Fill in a FileInfoBlock structure concerning a file associated with a particular filehandle.

Example

program Examine64Test;
uses
  AmigaDos;
procedure CheckDir(ALock: BPTR);
var
  FIB: PFileInfoBlock;
begin
  FIB := AllocDosObject(DOS_FIB, nil);
  if Assigned(FIB) then
  begin
    if Examine64(ALock, FIB, nil) <> 0 then
    begin
      repeat
        writeln(FIB^.fib_FileName);
      until ExNext64(ALock, FIB, nil) = 0;
    end;
    if IOErr() = ERROR_NO_MORE_ENTRIES then
      writeln('nothing more found')
    else
      writeln('Something went wrong ', IOErr);
    FreeDosObject(DOS_FIB, FIB);
  end;
end;
var
  RamLock: BPTR;
begin
  RamLock := Lock('RAM:', SHARED_LOCK);
  CheckDir(RamLock);
  Unlock(RamLock);
end.

Documentation generated on: 2021-07-30