Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!noao!arizona!naucse!wew From: wew@naucse.UUCP (Bill Wilson) Newsgroups: comp.sys.ibm.pc Subject: Re: Magic Number Five in turbo C, MS C, and int 21/0E Message-ID: <1748@naucse.UUCP> Date: 16 Oct 89 15:49:57 GMT References: <483@schaefer.MATH.WISC.EDU> Organization: Northern Arizona University, Flagstaff, AZ Lines: 38 From article <483@schaefer.MATH.WISC.EDU>, by wayne@schaefer.MATH.WISC.EDU (Rick Wayne): > we've run into a little problem here that i find baffling. we're trying to > determine the number of disk drives on a machine at runtime. there's a DOS > interrupt service for this: interrupt 0x21, function 0x0E, "set default > disk drive". it's supposed to return the number of drives in the system. > > for all the machines we have here (AST Premium 386, Standard 286, Compaq > Deskpro, Dell 210), we get the answer of...five. needless to say, these > disparate machines have differing numbers of drives. the one number we > CANNOT come up with, of course, is five. > I tried out the function and it worked just fine on my system. The function returns the number of drives that DOS thinks you have. Since I have the following in my config.sys: lastdrive=z the function reports 26. You may want to check your config for what is indicated in it. I used the following code to check: #include #include #include main() { int ndrvs; ndrvs=setdisk(getdisk()); printf("# of drives is %d\n",ndrvs); } I use getdisk so that I do not change the current drive. -- Let sleeping dragons lie........ | The Bit Chaser ---------------------------------------------------------------- Bill Wilson (Bitnet: ucc2wew@nauvm | wilson@nauvax) Northern AZ Univ Flagstaff, AZ 86011