delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/22/06:14:09

Date: Mon, 22 Dec 1997 13:12:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Thomas Koenig <tkoenig AT key DOT unizh DOT ch>
cc: djgpp AT delorie DOT com
Subject: Re: Drive informations using DJGPP
In-Reply-To: <349E26F9.77F0@key.unizh.ch>
Message-ID: <Pine.SUN.3.91.971222130620.11072A-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019