Solved

Disk Check Question

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

743 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

14 Experts available now in Live!

Get 1:1 Help Now