Go to the first, previous, next, last section, table of contents.


_get_dev_info

Syntax

#include <io.h>

short _get_dev_info(int handle);

Description

Given a file handle in handle, this function returns the info word from DOS IOCTL function 0 (Int 21h/AX=4400h). handle must refer to an open file or device, otherwise the call will fail (and set errno to EBADF).

In case of success, the returned value is the coded information from the system about the character device or the file which is referenced by the file handle handle. The following table shows the meaning of the individual bits in the return value:

For a character device:

  • Bit(s) Description
  • 14 Device can process IOCTL functions 02h and 03h
  • 13 Device supports output-until-busy
  • 11 Device supports OPEN/CLOSE calls
  • 8 Unknown; set by MS-DOS 6.2x `KEYBxx.COM'
  • 7 Always set for character devices
  • 6 End of file on input
  • 5 Device is in raw (binary) mode
  • 4 Device uses Int 29h
  • 3 Clock device
  • 2 NUL device
  • 1 Standard output device
  • 0 Standard input device For a block device (a disk file):
  • Bit(s) Description
  • 15 Device is remote (networked drive)
  • 14 Don't set file time stamp on close
  • 11 If set, non-removable media
  • 11 If clear, media is removable (e.g. floppy disk)
  • 8 Generate Int 24h if full disk or read past EOF
  • 7 Always clear for disk files
  • 6 File has not been written to
  • 5-0 Drive number (0 = A:) Note that the functionality indicated by bit 8 for the block devices is only supported by DOS version 4. Cooked mode means that on input C-C, C-P, C-S and C-Z are processed, on output `TAB's are expanded into spaces and `CR' character is added before each `LF', and input is terminated when the RET key is pressed. In contrast, in raw mode, all the special characters are passed verbatim, and the read operation waits until the specified number of characters has been read.

    Return Value The device information word described above. In case of error, -1 is returned and errno is set to EBADF.

    Portability not ANSI, not POSIX

    Example

     int fd = open ("CLOCK$", O_RDONLY | O_BINARY);
     int clock_info = _get_dev_info (fd);
    


    Go to the first, previous, next, last section, table of contents.