home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / GETCURDI.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  1.6 KB  |  58 lines

  1. /*---------------------------------------------------------------------------
  2.  * filename - getcurdi.cas
  3.  *
  4.  * function(s)
  5.  *        getcurdir - gets current directory for specified drive
  6.  *--------------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #pragma inline
  18. #include <asmrules.h>
  19. #include <dir.h>
  20. #include <_io.h>
  21.  
  22. /*--------------------------------------------------------------------------*
  23.  
  24. Name            getcurdir - gets current directory for specified drive
  25.  
  26. Usage           int getcurdir(int drive, char *direc);
  27.  
  28. Prototype in    dir.h
  29.  
  30. Description     getcurdir gets the name of the current working
  31.                 directory for the named drive.
  32.  
  33.                 drive contains a drive number (0 = default, 1 = A, etc.).
  34.  
  35.                 direc points to an area of memory of length MAXDIR where
  36.                 the directory name will be placed. The null-terminated name
  37.                 does not contain the drive specification and does not begin
  38.                 with a backslash.
  39.  
  40. Return value    getcurdir returns 0 on success or -1 in the event
  41.                 of error.
  42.  
  43. *---------------------------------------------------------------------------*/
  44. int     getcurdir(int drive, char *direc)
  45. {
  46.         pushDS_
  47. asm     mov     ah, 047h
  48. asm     mov     dl, drive
  49. asm     LDS_    si, direc
  50. asm     int     021H
  51.         popDS_
  52. asm     jc      getcurdirFailed
  53.         return(0);
  54.  
  55. getcurdirFailed:
  56.         return __IOerror(_AX);
  57. }
  58.