Previous: FindNext procedure To the Table of Content Next: FSplit procedure

- 4.24.2.13 -
Standard Units
Dos Unit
Dos Unit Procedures and Functions

FSearch function

Targets: MS-DOS, OS/2, Win32


Dos Unit

Searches for a file.

Declaration:
function FSearch(Path: PathStr; DirList: string): PathStr;
Remarks: Path is of type PathStr which is defined in the Dos unit. DirList is a list of the directories to include in the search each delimited with a semicolon (;).

FSearch returns the directory and file name if the file has been located. If Path is not found then an empty string is returned. FSearch always begins with the current directory and then checks the directories listed in DirList in the order that they appear.

Example:
uses
  Dos,Strings;
var
  DosPath,
  TreePath: String;
  File    : PathStr;
begin
  DosPath := GetPath;
  File    := 'TREE.COM';
  TreePath:= FSearch(File, DosPath);
  if Empty(TreePath) then
    Halt(1);
  TreePath := AppendBKSlash(TreePath);
  Exec(TreePath + File,'');
end.
See also:
FindFirst
FExpand
FSplit


Previous: FindNext procedure To the Table of Content Next: FSplit procedure
FindNext procedure Table of Content FSplit procedure

- 4.24.2.13 -