Solved

Cheking readiness of removable media drives

Posted on 1998-09-30
5
202 Views
Last Modified: 2010-04-15
We want to write an MS-DOS utiltiy that scans for information across all drives accessible on a user's system.  However we want to skip drives that have removable media (Floppies, CD-Rom, Zip, etc).  This is especially important if there is no media loaded in the drive because it can trigger DOS's "abort, retry, fail" prompt.

We are currently accomplishing this by skipping A: and B: and using some interrupt code to check if each subsequent drive is a CD-ROM.  A customer with a ZIP drive is now haveing the ARF problem because we are not detecting the unloaded ZIP drive and skipping it.  It's an annoyance.

Can the experts suggest a way to detect when a drive with removable media is currently not ready, or perhaps a better way of deciding which drives to skip, or at least a way for a DOS app to recognize a Zip drive.
0
Comment
Question by:robworley
5 Comments
 
LVL 2

Expert Comment

by:JYoungman
ID: 1253128
Try something like

#include <bios.h>

int drive_ready(int n)
{
   unsigned u = _biosdisk(_DISK_STATUS, NULL);
   return u != 0xAA;            
}

0
 
LVL 1

Expert Comment

by:Bonev
ID: 1253129
The ARF message is shown by the default Critical Error handler. If you want to avoid it, you have to set your own handler of Int 24h.
0
 

Expert Comment

by:clwells082798
ID: 1253130
Elaine Abduction. haha.
0
 
LVL 8

Accepted Solution

by:
jhurst earned 200 total points
ID: 1253131
SInce this is the C area I assume that you can use:

harderr(your_routine)  -this function takes as a parameter a routine that you want to perform when an Abort,Retry,Fail error happens.  Basically, you can just ignore the error and recognize that you read nothing.

0
 

Author Comment

by:robworley
ID: 1253132
Thanks JHURST:  Your suggestion looks good.  One question though: I just want to ignore ARF errors while this particular function is running.  Once I am done, how do I uninstall my handler and put the default handler back in place?


CLWELLS: I don't really understand what you are saying.  Is Elain Abduction ANSI standard or specific to a given compiler?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now