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)
Argument
- dir_spec
- A null-terminated character string naming a directory in either
an OpenVMS or UNIX style specification.
- . . .
- This argument is a DEC C extension available when not
defining any of the standards-related feature-test macros (see Section 1.5 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.
Description
This 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:
- Call chdir from USER mode with the second argument set to
1.
- Call chdir from SUPERVISOR or EXECUTIVE mode, regardless
of the value of the second argument.
Otherwise, the change is temporary.
Return Values
0 | Indicates that the directory is
successfully changed to the given name. |
-1 | Indicates that the change attempt has
failed. |
Previous Page | Next Page | Table of Contents | Index