Examine a directory or file associated with a lock
Source position: amigados.pas line 1673
function Examine( |
lock: LongInt; |
fileInfoBlock: PFileInfoBlock |
):LongBool; |
lock |
|
Pointer to a Lock |
fileInfoBlock |
|
allocated File info Block |
Examine() fills in information in the TFileInfoBlock concerning the file or directory associated with the lock. This information includes the name, size, creation date and whether it is a file or directory. FileInfoBlock must be longword aligned. Examine() gives a return code of False if it fails.
You may make a local copy of the TFileInfoBlock, as long as it is never passed to ExNext().
So, follow these steps to examine a directory:
|
Lock a directory or file |
|
|
Unlock a directory or file |
|
|
Examine the next entry in a directory |
|
|
Gets information on an open file |
|
|
Examine an entire directory |
program ExamineTest; uses AmigaDos; procedure CheckDir(ALock: BPTR); var FIB: PFileInfoBlock; begin FIB := AllocDosObject(DOS_FIB, nil); if Assigned(FIB) then begin if Examine(ALock, FIB) <> 0 then begin repeat writeln(FIB^.fib_FileName); until ExNext(ALock, FIB) = 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.