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

  1. /**
  2. *
  3. * Name        drsetdrv -- Select the default disk drive
  4. *
  5. * Synopsis    no_drives = drsetdrv(drive);
  6. *
  7. *        int no_drives      The number of drives installed
  8. *        int drive      The drive to select
  9. *
  10. * Description    This function selects the drive specified as the default
  11. *        disk drive.  The drive number corresponds to 0 = A:,
  12. *        1 = B:, etc.
  13. *
  14. *        The total number of logical disk drives (both fixed and
  15. *        diskette) is returned as the function value.  For single
  16. *        diskette drive systems, the diskette drive is counted
  17. *        twice because the single physical drive is associated
  18. *        with logical drives A: and B:.
  19. *
  20. *        If an invalid drive number is given, no action is taken.
  21. *
  22. * Returns    no_drives      The number of logical drives installed
  23. *
  24. * Version    3.0  (C)Copyright Blaise Computing Inc.  1983, 1984, 1986
  25. *
  26. **/
  27.  
  28. #include <bdirect.h>
  29. #include <butility.h>
  30.  
  31. int drsetdrv(drive)
  32. int drive;
  33. {
  34.     DOSREG dos_reg;
  35.  
  36.     dos_reg.ax = 0x0e00;          /* DOS function 0xE          */
  37.     dos_reg.dx = drive;
  38.     dos(&dos_reg);
  39.  
  40.     return (int) utlobyte(dos_reg.ax);
  41. }
  42.