[Overview][Constants][Types][Procedures and functions][Variables][Index] Reference for unit 'Dos' (#rtl)

FSearch

Search a file in searchpath

Declaration

Source position: dosh.inc line 111

function FSearch(

  path: PathStr;

  dirlist: string

):PathStr;

Description

FSearch searches the file Path in all directories listed in DirList. The full name of the found file is returned. DirList must be a list of directories, separated by semi-colons. When no file is found, an empty string is returned.

Remark: On Unix systems, DirList can also be separated by colons, as is customary on those environments.

Errors

None.

See also

FExpand

  

Expand a relative path to an absolute path

Example

program Example10;

uses Dos;

{ Program to demonstrate the FSearch function. }

var s:pathstr;

begin
  s:=FSearch(ParamStr(1),GetEnv('PATH'));
  if s='' then
    WriteLn(ParamStr(1),' not Found in PATH')
  else
    Writeln(ParamStr(1),' Found in PATH at ',s);
end.

Documentation generated on: May 14 2021