Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>getcurdir() get current directory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getcurdir()             Get Current Directory

 #include   <dir.h>

 int        getcurdir(drive,direc);
 int        drive;                       Drive number
 char       *direc;                      Pointer to directory name

    getcurdir() gets the name of the current working directory for
    'drive'.  'drive' is a drive number, where 0 = default, 1 = A, and so
    on.  'direc' is a pointer to the portion of memory where the
    directory name will be stored.  The area is of length MAXDIR. The
    name is null-terminated; it does not contain the drive specification,
    nor does it begin with a backslash.

       Returns:     0 if successful; -1 on error.

   Portability:     MS-DOS only.

   -------------------------------- Example ---------------------------------

    The following statements print the name of the current directory
    (without the drive specifier).

           #include <stdio.h>   /* for printf */
           #include <dir.h>     /* for getcurdir and MAXDIR */

           main()
           {
               char dirname[MAXDIR];

               getcurdir(0,dirname);   /* 0 = default drive */
               printf("The current directory is %s\n",dirname);
           }


See Also: getcwd()

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