Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - chdir() change to the specified dos directory http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 chdir()             Change to the specified DOS directory
------------------------------------------------------------------------------
 Declaration
   file.hdr

 Syntax
   func logical chdir extern
   param const char cDirectory

 Arguments
   cDirectory is the path specification.

 Return
   A logical indicating the success of operation.

 Description
   The chdir() function changes the current DOS directory to cDirectory.
   The cDirectory parameter may include a drive designation.

   Use chdir() instead of set default to because chdir() returns information
   as to whether or not it was successful, while the set default to command
   does not.

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   proc Test_chdir
   vardef
      char cCurDir
      char cNewDir
   enddef
   run "dir"                                // show directory listing
   cCurDir := curdir( 0 )                   // save current directory
   cNewDir := space( 50 )                   // initialize get variable
   @ row(), 0 say "Which dir: " get cNewDir // get new directory name
   read                                     // activate the get
   if chdir( cNewDir )                      // attempt to change to new dir
      ? "Switched to", curdir( 0 )
      wait
      chdir( cCurDir )                      // restore original directory
      ? "Restored directory", curdir( 0 )
      wait
   endif
   endproc

   proc main
   Test_chdir()
   endproc

See Also: curdir() isdir() set default to

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