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
Solved

Disk Check Question

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

809 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