home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / DRCHDIR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  1023 b   |  41 lines

  1. /**
  2. *
  3. * Name        drchdir -- Change the current directory on a given
  4. *               disk drive.
  5. *
  6. * Synopsis    ercode = drchdir(pdir_name);
  7. *
  8. *        int  ercode      Returned error code
  9. *        char *pdir_name   Path name of the new directory
  10. *
  11. * Description    DRCHDIR changes the current directory to the directory
  12. *        specified in the path name.  A device specifier may be
  13. *        included to change the current directory of a disk drive
  14. *        which is not the default drive.  If any member of the
  15. *        path is not the name of a subdirectory, the current
  16. *        directory is not altered and a nonzero error code is
  17. *        returned.
  18. *
  19. * Returns    ercode          DOS function error code
  20. *
  21. * Version    3.0  (C)Copyright Blaise Computing Inc.  1983, 1984, 1986
  22. *
  23. **/
  24.  
  25. #include <bdirect.h>
  26. #include <butility.h>
  27.  
  28. int drchdir(pdir_name)
  29. char *pdir_name;
  30. {
  31.     DOSREG dos_reg;
  32.     ADS    dir_ads;
  33.  
  34.     dos_reg.ax = 0x3b00;
  35.     utabsptr(pdir_name,&dir_ads);
  36.     dos_reg.ds = dir_ads.s;
  37.     dos_reg.dx = dir_ads.r;
  38.  
  39.     return(dos(&dos_reg));
  40. }
  41.