home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / GETCURDI.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.9 KB  |  59 lines

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