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

ChDir

Change current working directory.

Declaration

Source position: systemh.inc line 1360

procedure ChDir(

  const s: shortstring

); overload;

procedure ChDir(

  const s: RawByteString

); overload;

procedure ChDir(

  const s: unicodestring

); overload;

Description

Chdir changes the working directory of the process to S.

Errors

Depending on the state of the {$I} switch, a runtime error can be generated if there is an error. In the {$I-} state, use IOResult to check for errors.

See also

Mkdir

  

Create a new directory.

Rmdir

  

Remove directory when empty.

Example

Program Example7;

{ Program to demonstrate the ChDir function. }

begin
  {$I-}
  ChDir (ParamStr(1));
  if IOresult<>0 then
    Writeln ('Cannot change to directory : ',paramstr (1));
end.


Documentation generated on: May 14 2021