Path: 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 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 #include #include #include 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); }