delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/12/12:16:47

Date: Mon, 12 Jun 95 16:57:53 +0200
From: vincent AT physique DOT ens DOT fr (CROQUETTE Vincent)
To: djgpp AT sun DOT soe DOT clarkson DOT edu

>>Subject: Re: Floppy Error Msg supression

>> Does anybody know how to supress the 'Abort,Retry, or Cancel' msg when you 
>> don't have a floppy disc loaded and you've tried to save/load. We've got this> 
>> box with a 386 in it and no monitor (or keyboard). We get interaction from a> >
>> series of knobs and buttons.

>You can try to read the first disk sector with a BIOS call, like this:

>          unsigned char buf[512];
>          int bios_status, count = 0;
 
>          /* Int 13h/AH=02h returns 6 for disk changed, even if the
>             disk isn't readable (e.g., unformatted).  Retry the
>             operation after disk change, each time resetting the 
>             drive, until something other than 6 is returned or we
>             run out of our patience.  */
>          while (++count < 10 && (bios_status =
>                 biosdisk(2, drive_number - 1, 0, 0, 1, 1, buf)) == 6)
>            biosdisk(0, drive_number - 1, 0, 0, 0, 0, NULL);
> 
>          /* If the loop ends with nonzero status, fail.  */
>          if (bios_status != 0)
>            do-whatever-it-takes-for-empty-drive;


there is another simpler way which work for me that may not be so clever
try "findfirst" if no disquette is in the drive it give an error message
but does not hang !

ex:

		if (findfirst(name,&fb,0) != 0) 
			win_printf("error in writing \n%s",lname);


Vincent Croquette  

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019