Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>chdir</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
chdir

Usage

   #include <direct.h>
   int chdir(char *path);

Description

   chdir is a system call that changes the current directory to the
   directory specified in the path argument. path must be a valid directory.

   It is possible to specify a drive in the path argument, in which case the
   current directory on that drive is changed, but the current drive is not
   changed.

Example 

   #include <direct.h>
   #include <stdio.h>
   #include <stdlib.h>

   char *path = "\temp";
   int main()
   {
       int result;
       result = chdir(path);
       if (result != 0) {
           printf("Couldn't change directory\n");
           return EXIT_FAILURE;
       } else
           printf("Directory changed to %s\n",path);

       return EXIT_SUCCESS;
   }

Return Value

   Returns a 0 upon success otherwise a -1 and errno is set.

See Also

   mkdir, rmdir



See Also: mkdir rmdir

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson