Expand/Shrink

chdir

Definition: bool success = chdir(sequence s)
Description: Set the current directory to the path given by sequence s.
s must name an existing directory on the system.
If successful, chdir() returns true (1).
If unsuccessful, chdir() returns false (0).
pwa/p2js: Not supported.
Comments: By setting the current directory, you can refer to files in that directory using just the file name.

The function current_dir() returns the name of the current directory.

On Windows the current directory is a global property shared by all the processes running under one shell.
On Linux, a subprocess can change the current directory for itself, but this will not affect the current directory of its parent process.

While s is declared as a sequence, you should assume it is a string.
Example:
if chdir(`C:\euphoria`) then
    f = open("readme.doc", "r")
else
    puts(1, "Error: No euphoria directory?\n")
end if
Implementation: See builtins\pchdir.e (an autoinclude) for details of the actual implementation.
See Also: current_dir