delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/02/10/06:53:37

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <09da01c3efcc$6e1ce4a0$0600000a@broadpark.no>
From: "Gisle Vanem" <giva AT bgnett DOT no>
To: <djgpp AT delorie DOT com>
References: <4028B2D6 DOT 6020004 AT lml DOT ls DOT fi DOT upm DOT es>
Subject: Re: Getting available logical drives
Date: Tue, 10 Feb 2004 12:52:59 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Reply-To: djgpp AT delorie DOT com

"Manuel Collado" <m DOT collado AT aaron DOT ls DOT fi DOT upm DOT es> said:

> Is there a DJGPP lib function equivalent to the Ms-Windows 
> GetLogicalDrives one?
..
> Is there a way to simply test if a drive is _installed_ in the machine?

If I understand you correctly, you can use _truename("x:\", result);
Loop over all drive-letters. Or maybe simpler with something like:

struct mntent *mnt;
FILE *f;
for  (f = setmntent(NULL,NULL); f; mnt = getmntent(f)) {
  if (mnt->mnt_dir[1] == ':')
    ; /* check drivelettter mnt->mnt_dir[0] */
  if (!mnt)
   break;
}
endmntent(f);

Look at the mntent.c in the djgpp source. It's seem to handle
a lot of special cases.

--gv

- Raw text -


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