Solved

Disk Check Question

Posted on 2002-06-11
4
218 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 50 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

696 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