CHDIR

Portability Function: Changes the default directory.

Module: USE DFPORT

Syntax

result = CHDIR(dir_name)

dir_name
(Input) Character*(*). Name of a directory to become the default directory.

Results:

The result is of type INTEGER(4). It returns zero if the directory was changed successfully; otherwise, an error code. Possible error codes are:

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: CHANGEDIRQQ

Example

     integer(4) istatus, enoent, enotdir
     character*(*) newdir, prompt, errmsg
     prompt = 'Please enter directory name: '
10     write *, prompt
     read *, newdir
     ISTATUS = CHDIR(newdir)
     select case (istatus)
       case (enoent)
         errmsg = 'The directory'//newdir//' does not exist'
       case (enotdir)
         errmsg = newdir//' is not a directory'
       case else
         goto 40
     end select
     write *, errmsg
     goto 10
40     write *, 'Default directory successfully changed.'
     end