How to detect floppy disk in disk drive

Need help. Anyone have any code to detect a floppy in the disk drive so that if you try to access something on the disk, you don't get that awful "Abort Retry" (because the disk drive is empty)?

Preciate your help.

Comments

  • I don't know if this will help you, but you can do this:

    dir a: > nul

    This will output nothing if the floppy is inserted and "The device is not ready" if there's no floppy. You can also try:

    dir a: /b > file.txt

    Again, it will output the same thing, but if the drive is ready, file.txt will include all files on floppy. If there's no disk, file.txt will exist but will be empty. Note that you cannot do a lot of things in DOS codes.

    Regards

    Francis Lacroix a.k.a Netcoder
    Programmer


  • Thanks for the reply. I am aware of the dir commands. The stopping of the process and the reply "The device is not ready" is the problem.

    For instance. Suppose I am in the middle of executing a program written in C. And I want to know if I can write something to a Floppy. I would like for the C program to interrogate the FD drive to determine if a floppy is inserted before attempting to write to it. If the floppy is there, there is no problem - the floppy is written to and the C program continues on. But if the floppy is not there, the C program "STOPS" with the message "The device is not ready".

    I would like to just continue on or maybe even abort the program if the floppy is not there. But stopping and displaying "The device is not ready" is undesirable.

    I have downloaded some code from somewhere on the net which does prevent the reply - posted in one of my previous replies. However, this code produces some extensive floppy disk-drive chatter (noise) which also is undesirable.

    Anyway, thanks for the feedback.



    : I don't know if this will help you, but you can do this:
    :
    : dir a: > nul
    :
    : This will output nothing if the floppy is inserted and "The device is not ready" if there's no floppy. You can also try:
    :
    : dir a: /b > file.txt
    :
    : Again, it will output the same thing, but if the drive is ready, file.txt will include all files on floppy. If there's no disk, file.txt will exist but will be empty. Note that you cannot do a lot of things in DOS codes.
    :
    : Regards
    :
    : Francis Lacroix a.k.a Netcoder
    : Programmer
    :
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories