Sign in Join
FPDoc Onlineexperiment

FSearch function

In unit Dos

Search a file in searchpath.

Declaration

pascal
function FSearch(path: PathStr; dirlist: shortstring): 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.

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

Errors

None.

See also

Example: ex10

pascal
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.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.