ChDir
Jump to navigation
Jump to search
Changes the current directory.
- Declaration
- procedure ChDir(S: String);
- Target
- Windows, Real, Protected
- Remarks
- With $I-, IOResult returns 0 if the operation was successful. Otherwise, it returns a non-zero error code.
- The current directory is changed to the path specified by S. If S specifies a drive letter, the current drive is also changed.
Sample Code
{Chdir.PAS} {Sample code for the ChDir procedure.} { For Windows: } { uses WinCrt; } begin {$I-} { Get directory name from command line } ChDir(ParamStr(1)); if IOResult <> 0 then Writeln('Cannot find directory'); end.