home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD2.mdf
/
c
/
library
/
mslang
/
cp1
/
drvs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-10
|
4KB
|
105 lines
===========================================================================
BBS: The Abacus * HST/DS * Potterville, MI
Date: 06-05-93 (12:36) Number: 36
From: DAVID GERSIC Refer#: NONE
To: DANIEL LYNES Recvd: NO
Subj: Re: Problem(?) Conf: (36) C Language
---------------------------------------------------------------------------
/* Quoting Daniel Lynes on 05-31-93 03:42... */
BS>** Includes drive letters assigned with DOS SUBST command
BS>** Networked drives are left as an exercise as I don't have access BS>** t
DL> them to check.
DL> Ok, well the routine that I was attempting to write would allow
DL> inclusion of Novell networked drives as well.
I don't know why Bob didn't post mine, instead...
/*
** DRVS.C - public domain by David Gersic, DeKalb, Il 1993
**
** Routine checks how many valid disk drives are available on machine,
** both physical and logical drives.
**
** Includes drive letters assigned with DOS SUBST command and network
** drives for Novell Netware (and probably other networks).
**
** Compiled Under MSC 6 LARGE memory Model
** Should be compatible with other DOS compilers
**
*/
#include <stdio.h>
#include <dos.h>
#include <stdlib.h>
main()
{
union REGS in, out;
int i;
/* Novell's shell TSRs allow up to 31 drive 'letters' to be created */
char drives[]={' ','a','b','c','d','e','f','g','h','i','j',
'k','l','m','n','o','p','q','r','s','t','u',
'v','w','x','y','z','[','\\',']','^','`'};
in.x.ax=0x4409;
for(i=1;i<32;i++)
{
in.h.bl=(unsigned char)i;
intdos(&in,&out);
if(!out.x.cflag)
printf("drive %c: is %s\n",
drives[i],out.x.dx & 1<<15 ? "subst" :
out.x.dx & 1<<12 ? "network" : "local");
}
return(0);
}
... CALCULUS: the agony and dx/dt
--- FMail 0.92
* Origin: NIU Connection (815)753-1800 (1:11/70.0)
SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
===========================================================================
BBS: The Abacus * HST/DS * Potterville, MI
Date: 06-07-93 (23:57) Number: 261
From: DAVID GERSIC Refer#: NONE
To: BOB STOUT Recvd: NO
Subj: DRVS.C Conf: (36) C Language
---------------------------------------------------------------------------
I just noticed a bug in my DRVS.C code. I missed a drive "letter"...
Corrected code here:
#include <stdio.h>
#include <dos.h>
#include <stdlib.h>
main()
{
union REGS in, out;
int i;
char drives[]={' ','a','b','c','d','e','f','g','h','i','j',
'k','l','m','n','o','p','q','r','s','t','u',
'v','w','x','y','z','[','\\',']','^','_','`'};
in.x.ax=0x4409;
for(i=1;i<32;i++)
{
in.h.bl=(unsigned char)i;
intdos(&in,&out);
if(!out.x.cflag)
printf("drive %c: is %s\n",
drives[i],out.x.dx & 1<<15 ? "subst" :
out.x.dx & 1<<12 ? "network" : "local");
}
return(0);
}
... The average, healthy adult gets up at 7:30am feeling terrible.
--- FMail 0.92
* Origin: NIU Connection (815)753-1800 (1:11/70.0)
SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20