Mail Archives: djgpp/1997/12/22/06:14:09
On Mon, 22 Dec 1997, Thomas Koenig wrote:
> Can anybody tell my how to obtain information about available drives
> (under DOS/WIN95) using DGJPP? I spent a night with info and could not
> find out... I would like to write a C function that tells my
>
> a) If the drive exists,
> b) If it can be read.
(a) can be achieved by calling `setdisk' which returns the total number
of drives known to DOS. The example in the libc reference is exactly
what you need:
printf("There are %d drives\n", setdisk(getdisk )));
For (b) use the library function `getmntent'. It returns all the drives
that are accessible, one at a time, and the type of the drive (fixed,
removable, CD, RAM, networked, etc.).
- Raw text -