home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / dos / csap208b.lzh / ISDEV.C < prev    next >
Text File  |  1987-07-30  |  997b  |  31 lines

  1. /* ISDEVICE - Will invoke Ms-Dos IOCTL function to "get" the attributes
  2.              of the specified DOS handle.
  3.  
  4.              Result := True     If the specified handle is a device.
  5.                     := False    If the specified handle is a file.
  6.  
  7.              Caution: A True return only indicates that the handle is
  8.                       assigned to a device driver.  These include the
  9.                       CON, PRN, AUX and any user installed device drivers.
  10.  
  11.                       A False return indicates that the handle is assigned
  12.                       to a file that may be on a Floppy, Hard Disk or
  13.                       Ram Disk.
  14. */
  15.  
  16. #include <stdio.h>
  17. #include <dos.h>
  18.  
  19. isdevice (handle)
  20. int handle;
  21. {
  22.     union REGS R;
  23.  
  24.     R.x.ax = 0x4400;            /* MS-DOS IOCTL "Get" function */
  25.     R.x.bx = handle;            /* ... Handle for IOCTL "Get"  */
  26.     R.x.dx = 0;
  27.     intdos(&R, &R);                /* ... MS-DOS Entry Interrupt  */
  28.     if ((R.x.dx & 0x80) == 0) return(0);
  29.     else return(1);
  30. }
  31.