Article View: comp.os.msdos.programmer
Article #2764Re: Number of drives on system, how do you find out the ...
From: Ted Nolan
Date: Mon, 22 Oct 1990 15:29
Date: Mon, 22 Oct 1990 15:29
42 lines
1513 bytes
1513 bytes
Here's a little program we use from batch files to see if a drive is
valid; with a little modification, it should do what you want. It
works with MIX C, and presumably with turbo and msc. It stats a file on
a disk and sees if you would have gotten "abort,retry,ignore".
Ted Nolan
ted@usasoc.soc.mil
---------------------------------------CUT HERE-------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <sys\stat.h>
int dstatus = 0;
main(int argc, char **argv)
{
int harderror(int error, int ax, int bp, int si);
char path[15];
struct stat statbuf;
if( argc != 2) {
fprintf(stderr,"Usage %s d\n",argv[0]);
fprintf(stderr,"Where d is a drive letter\n");
exit(1);
}
sprintf(path,"%s:\\foo\\bar",argv[1]);
harderr(harderror);
(void) stat(path,&statbuf);
exit(dstatus);
}
int harderror(int error, int ax, int bp, int si)
{
dstatus = 1;
hardresume(0);
}
Technical Details
Message-ID:
<1990Oct22.152951.24125@usasoc.soc.mil>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!decwrl!ads.com!sparkyfs!usasoc.soc.mil!newsReferences:
<1085@duteca4.UUCP> <25000@uflorida.cis.ufl.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!decwrl!ads.com!sparkyfs!usasoc.soc.mil!news From: ted@arsocomvax.socom.mil (Ted Nolan) Newsgroups: comp.os.msdos.programmer Subject: Re: Number of drives on system, how do you find out the ... Keywords: MS-DOS, drives Message-ID: <1990Oct22.152951.24125@usasoc.soc.mil> Date: 22 Oct 90 15:29:51 GMT References: <1085@duteca4.UUCP> <25000@uflorida.cis.ufl.EDU> Reply-To: ted@usasoc.soc.mil (Ted Nolan) Distribution: usa Organization: SRI International Lines: 42