chdir EXPR

Definition and Usage

Changes the current working directory to EXPR, or to the user’s home directory if none is specified. This function call is equivalent to Unix command cd EXPR.

Return Value

  • 0 on failure
  • 1 on success


Assuming you are working in /user/home/tutorialspoint directory. Execute following program:

chdir "/usr/home";

# Now you are in /usr/home dir.


# Now you are in home directory /user/home/tutorialspoint

What Do You Think on This ? Say Here

This site uses Akismet to reduce spam. Learn how your comment data is processed.