Previous: 4.24.2.12. FindNext To the Table of Contents Next: 4.24.2.14. FSplit
4.24.2.12. FindNext Table of Contents 4.24.2.14. FSplit

- 4.24.2.13. -
Table of Contents
4. Standard Units
4.24. DOS - MSDOS support unit
4.24.2. DOS Unit Procedures and Functions
4.24.2.13. FSearch


4.24.2.13. FSearch

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: 4.24.2.12. FindNext To the Table of Contents Next: 4.24.2.14. FSplit
4.24.2.12. FindNext Table of Contents 4.24.2.14. FSplit

- 4.24.2.13. -