chdir

Syntax

int chdir(string path)

Arguments

path
The path of the directory/folder you want to change to.

Return

Returns 0 if the system successfully changed to the new folder, non-zero otherwise.

Description

Changes the current working directory to the specified directory/folder on the user's filesystem. Remember to use double backslashes in the path.

Example

if (chdir("c:\\abc\\mynewfolder") != 0) {
  msgBox(MB_OK, "Successful", "Successfully changed the current working directory.");
}
else msgBox(MB_OK | MB_ICONWARNING, "Error", "The system was unable to change to the given folder.");

Also see

getSpecialFolder, rmdir, getcwd

Comments

Everyone can add their comments about their experiences with this function here. Tips for using it are welcome, too.