[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 9.40 ChDir

### Synopsis

    procedure ChDir (Directory: String);

### Description

``ChDir'` changes the current directory to Directory, if its argument is a valid parameter to the related operating system's function. Otherwise, a runtime error is caused.

### Conforming to

``ChDir'` is a Borland Pascal extension.

### Example

    program ChDirDemo;
    var
      Foo: String (127);
    begin
      WriteLn ('Enter directory name to change to:');
      ReadLn (Foo);
      {$I-}  { Don't abort the program on error }
      ChDir (Foo);
      if IOResult <> 0 then
        WriteLn ('Cannot change to directory `', foo, '''.')
      else
        WriteLn ('Okay.')
    end.

### See also

section 9.161 MkDir, section 9.234 RmDir

This document was generated by Frank Heckenbach on May, 10 2002 using texi2html