delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/19/14:27:11

Date: Fri, 19 Jan 1996 22:17:35 +0300 (MSK)
From: "Alexander V. Lukyanov" <lav AT video DOT yars DOT free DOT net>
To: A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk, DJGPP AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Finding which drives exist

> From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
>
>                                            Please how in Gnu C++ can I find
> easily at run time for(i='A';i<='Z';i++) whether drive i exists? And I don't
> want in the process any empty floppy or CD-ROM drives making rude noises at me
> or wanting Abort/Fail/Retry. I don't mind if an empty floppy drive is treated
> as nonexistent.

For each drive try to set it as current and then look if the current drive is
the same as set. Beware: I didn't test it.

for(i='A'; i<='Z'; i++)
{
   set_current_drive(i);
   if(i==get_current_drive(i))
      /* the drive i does exist */ ;
}

This should detect empty floppy and cdrom drives too.
---
Alexander Lukyanov
lav AT video DOT yars DOT free DOT net

- Raw text -


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