VMS Help  —  CRTL  chdir
    Changes the default directory.

    Format

      #include  <unistd.h>

      int chdir  (const char *dir_spec); (ISO POSIX-1)

      int chdir  (const char *dir_spec, . . . ); (DEC C Extension)

1  –  Arguments

 dir_spec

    A null-terminated character string naming a directory in either
    an OpenVMS or UNIX style specification.

  . . .

    This argument is an Compaq C extension available when not
    defining any of the standards-related feature-test macros and not
    compiling in strict ANSI C mode (/STANDARD=ANSI89). The argument
    is an optional flag of type int that is significant only when
    calling chdir from USER mode.

    If the value of the flag is 1, the new directory is effective
    across images. If the value is not 1, the original default
    directory is restored when the image exits.

2  –  Description

    The chdir function changes the default directory. The change can
    be permanent or temporary. Permanent means that the new directory
    remains as the default directory after the image exits. Temporary
    means that on image exit, the default is set to whatever it was
    before the execution of the image.

    There are two ways of making the change permanent:

    o  Call chdir from USER mode with the second argument set to 1.

    o  Call chdir from SUPERVISOR or EXECUTIVE mode, regardless of
       the value of the second argument.

    Otherwise, the change is temporary.

3  –  Return Values

    0                  Indicates that the directory is successfully
                       changed to the given name.
    -1                 Indicates that the change attempt has failed.
Close Help