?
Solved

Disk Check Question

Posted on 2002-06-11
4
Medium Priority
?
222 Views
Last Modified: 2010-04-02
Guys...

I am writing an application, where I have to check if a floppy disk drive is ready with a disk in it.
What is the method I should use?

I would consider any C/Java/Ada code snippets to see how this can be done.

Thanks
prain
0
Comment
Question by:prain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 7069751
Under Win32:

Call 'GetVolumeInformation()' for the floppy drive

Under UN*X:

Call 'statfs()' for the respective mount point
0
 
LVL 4

Expert Comment

by:mblat
ID: 7070074
That is code snippet:

bool IsFloppyInserted()
{
    UINT uOldStatus = SetErrorMode(SEM_FAILCRITICALERRORS);
     bool bStatus = false;
     
     /* Save current drive and directory. */
     int nCurdrive = _getdrive();        // Get current drive
     TCHAR buffer[_MAX_PATH];
     _tgetcwd(buffer, _MAX_PATH);

     /* If we can switch to the drive, it exists. */
     if(!_chdrive(1))
          bStatus = true;
     
     /* Restore original drive.*/
     _chdrive(nCurdrive);                // Restore OLD drive
     _tchdir(buffer);                      // Restore OLD directory
    SetErrorMode(uOldStatus);
     
     return bStatus;
}

Hope it helps...
0
 
LVL 11

Expert Comment

by:griessh
ID: 7262245
Dear prain

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "jkr"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7332929
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

777 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