Date: Mon, 22 Dec 1997 13:12:35 +0200 (IST) From: Eli Zaretskii To: Thomas Koenig cc: djgpp AT delorie DOT com Subject: Re: Drive informations using DJGPP In-Reply-To: <349E26F9.77F0@key.unizh.ch> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.).