Author |
Message |
COGET Stephan #1 / 13
|
 Check drive A
How can i check if a disk is in A: without a message error windows appearing when A: is empty ? How can i check if a disk is protected or not ? Thanks.
|
Sat, 02 Jan 1999 03:00:00 GMT |
|
 |
Tony Pa #2 / 13
|
 Check drive A
Quote:
>How can i check if a disk is in A: without a message error >windows appearing when A: is empty ? >How can i check if a disk is protected or not ? >Thanks.
NANFOR.LIB have got nice disk i/o routines that are public domain. I'm using NFLIB3.5, wonder what's the version now?
|
Sat, 02 Jan 1999 03:00:00 GMT |
|
 |
Andreas Wei #3 / 13
|
 Check drive A
Quote:
> How can i check if a disk is in A: without a message error > windows appearing when A: is empty ? > How can i check if a disk is protected or not ? > Thanks.
There are some funktions in nantucket tools. DISKREADY(..) checks the Diskdrive (locks for a disk in drive) DISKSPACE(..) checks the free space on disk. ! DISKSPACE without a disk in drive returns wrong value. ! Before using DISKSPACE check drive with DISKREADY. Andreas Wei?, Germany
|
Sat, 02 Jan 1999 03:00:00 GMT |
|
 |
D.Capdeviell #4 / 13
|
 Check drive A
Quote: >How can i check if a disk is in A: without a message error >windows appearing when A: is empty ? >How can i check if a disk is protected or not ? >Thanks.
Bonjour, You can try FT_FLOPTST(), a new function in nanforum lib. Hope this help Didier CAPDEVIELLE Comite Technique Permanent du Reseau SIBIL France
|
Sat, 02 Jan 1999 03:00:00 GMT |
|
 |
Dave Pearso #5 / 13
|
 Check drive A
Quote:
> How can i check if a disk is in A: without a message error > windows appearing when A: is empty ? > How can i check if a disk is protected or not ? > Thanks.
Here is one that works for me, hope it helps. -ISDRIVE.PRG--------------------------------------------------------------- #include "Common.Ch" /* $DOC$ * $FUNCNAME$ * IsDrive() * $CATEGORY$ * Environment * $ONELINER$ * Check to see if a drive exists. * $SYNTAX$ * IsDrive( [<ncDrive>] ) --> lExists * $ARGUMENTS$ * <ncDrive> is an optional numeric or character parameter that is * the ID of the drive to check. The drive can be the character * values A-Z or the numeric values 0-25 (0 = A:, 1 = B:, ...). * If not supplied the "current drive" is checked. * $RETURNS$ * .T. if the drive exists, .F. if not. * $DESCRIPTION$ * IsDrive() can be used to check if a drive exists, this also * includes been able to check if a disk is in a floppy drive. * $EXAMPLES$ * ? IsDrive( "A:" ) // Test for A: * ? IsDrive( "A" ) // Same * ? isDrive( "Allo!" ) // Same again, only the first character * // is used. * ? IsDrive( 0 ) // Same again using a numeric. * $SEEALSO$ * * $END$ */ Function IsDrive( ncDrive ) Local nFile Local lDrive Do Case Case ISCHARACTER( ncDrive ) If isalpha( ncDrive ) nFile := fopen( left( ncDrive, 1 ) + ":\NUL" ) Else nFile := fopen( "NUL" ) EndIf Case ISNUMBER( ncDrive ) If ncDrive >= 0 .And. ncDrive <= 25 nFile := fopen( chr( 65 + ncDrive ) + ":\NUL" ) Else nFile := fopen( "NUL" ) EndIf Otherwise nFile := fopen( "NUL" ) EndCase lDrive := ( ferror() == 0 ) fclose( nFile ) Return( lDrive ) -ISDRIVE.PRG--------------------------------------------------------------- -- Take a look in Hagbard's World: | w3ng - The WWW Norton Guide reader. http://www.acemake.com/hagbard | ng2html - The NG to HTML converter. For pgp public key send mail to | eg - Norton Guide reader for OS/2.
|
Sat, 02 Jan 1999 03:00:00 GMT |
|
 |
Ian Da #6 / 13
|
 Check drive A
+- | Here is one that works for me, hope it helps. | | -ISDRIVE.PRG--------------------------------------------------------------- |[snip] | Case ISCHARACTER( ncDrive ) | If isalpha( ncDrive ) | nFile := fopen( left( ncDrive, 1 ) + ":\NUL" ) | Else | nFile := fopen( "NUL" ) | EndIf | Case ISNUMBER( ncDrive ) | If ncDrive >= 0 .And. ncDrive <= 25 | nFile := fopen( chr( 65 + ncDrive ) + ":\NUL" ) | Else | nFile := fopen( "NUL" ) | EndIf +-[DP=>All] Oh come one Dave, it couldn't have been more than two weeks ago that we were all talking about NOT using the NUL device as it doesn't work on some network configs... <g> Try this in C instead: #include "extend.api" extern int __cdecl _tisdrv (unsigned nDrive); CLIPPER IsDrive(void) { int nDrive; if (ISCHAR(1) && _parclen (1)) { char * cDrivePtr = _parc (1); nDrive = *cDrivePtr - 65 - (*cDrivePtr >= 'a' && *cDrivePtr <= 'z' ? 32 : 0); } else if (ISNUMERIC (1)) { nDrive = _parni (1); } else { _retl (FALSE); return; } return (_tisdrv (nDrive) == 0); // 0 returned if valid } Much better... ;-) DrDebug . DBMR v1.00 . MrDebug - Simply the Best +----------------------------------+--------------------------------------+
| The Dark Knight Returns BBS | MrDebug product support: |
| and MrDebug for Windows | Fax&BBS: +44 (0)1480 471465 | |(MrDebug: THE CA-Clipper de{*filter*})| Tel: +44 (0)1480 403104 | +----------------------------------+--------------------------------------+
|
Sat, 02 Jan 1999 03:00:00 GMT |
|
 |
Ian Da #7 / 13
|
 Check drive A
+- | > Oh come one Dave, it couldn't have been more than two weeks ago that we were | > all talking about NOT using the NUL device as it doesn't work on some | > network configs... <g> | | *FLOPPY* drive Ian, the guy was asking about a *Floppy* drive. Also, that | discussion was about checking for directories. The function I gave was for | checking if a drive was there. I've yet to see a config that pretends | that a drive is there when it isn't. +-[DP=>ID] Yes, and you gave him an ISDRIVE() function!!! And you were in total agreement that different configs don't agree... <g> Having a nice day are we?... ;-) DrDebug . DBMR v1.00 . I want to be a MrDebug Developer when I grow up +----------------------------------+--------------------------------------+
| The Dark Knight Returns BBS | MrDebug product support: |
| and MrDebug for Windows | Fax&BBS: +44 (0)1480 471465 | |(MrDebug: THE CA-Clipper de{*filter*})| Tel: +44 (0)1480 403104 | +----------------------------------+--------------------------------------+
|
Sun, 03 Jan 1999 03:00:00 GMT |
|
 |
Dave Pearso #8 / 13
|
 Check drive A
Quote:
> Oh come one Dave, it couldn't have been more than two weeks ago that we were > all talking about NOT using the NUL device as it doesn't work on some > network configs... <g>
*FLOPPY* drive Ian, the guy was asking about a *Floppy* drive. Also, that discussion was about checking for directories. The function I gave was for checking if a drive was there. I've yet to see a config that pretends that a drive is there when it isn't. -- Take a look in Hagbard's World: | w3ng - The WWW Norton Guide reader. http://www.acemake.com/hagbard | ng2html - The NG to HTML converter. For pgp public key send mail to | eg - Norton Guide reader for OS/2.
|
Sun, 03 Jan 1999 03:00:00 GMT |
|
 |
Dave Pearso #9 / 13
|
 Check drive A
Quote:
> | *FLOPPY* drive Ian, the guy was asking about a *Floppy* drive. Also, that > | discussion was about checking for directories. The function I gave was for > | checking if a drive was there. I've yet to see a config that pretends > | that a drive is there when it isn't. > +-[DP=>ID] > Yes, and you gave him an ISDRIVE() function!!! And you were in total > agreement that different configs don't agree... <g>
Ok, I'll repeat it again, NUL is bad for directories, NUL is good for drives. I've yet to find the NUL trick to fail for drives (but I'm sure someone out there can make it fail). Anyway, I prefer your version, it's in the one true language. :-) Quote: > Having a nice day are we?... ;-)
Every day is a nice day. <g> -- Take a look in Hagbard's World: | w3ng - The WWW Norton Guide reader. http://www.acemake.com/hagbard | ng2html - The NG to HTML converter. For pgp public key send mail to | eg - Norton Guide reader for OS/2.
|
Mon, 04 Jan 1999 03:00:00 GMT |
|
 |
Anne Krijge #10 / 13
|
 Check drive A
<< Ok, I'll repeat it again, NUL is bad for directories, NUL is good for drives. I've yet to find the NUL trick to fail for drives (but I'm sure someone out there can make it fail). >> For those out there willing to test this (not me :); does it work for RAM-drives ? And for drive B: when there's just one floppy drive in the system ? Inquiring minds want to know :) Anne.
|
Mon, 04 Jan 1999 03:00:00 GMT |
|
 |
Dave Pearso #11 / 13
|
 Check drive A
Quote:
> << Ok, I'll repeat it again, NUL is bad for directories, NUL is good for > drives. I've yet to find the NUL trick to fail for drives (but I'm > sure someone out there can make it fail). >> > For those out there willing to test this (not me :); does it work for > RAM-drives ? And for drive B: when there's just one floppy drive in the > system ?
I don't know about RAM drives (I would guess it works ok), but it would probably fail with a "virtual" drive B. However, I've got this one covered too. Take a look at the GT library, I've got some code in there that will tell you if you have one or two floppy drives and, if you only have one, what drive it is pretending to be. So, with all those functions together, you should be just about covered. Quote: > Inquiring minds want to know :)
That's what I love about comp.lang.clipper, everyone is a critic. :-) -- Take a look in Hagbard's World: | w3ng - The WWW Norton Guide reader. http://www.acemake.com/hagbard | ng2html - The NG to HTML converter. For pgp public key send mail to | eg - Norton Guide reader for OS/2.
|
Mon, 04 Jan 1999 03:00:00 GMT |
|
 |
Ian Da #12 / 13
|
 Check drive A
+- | > Yes, and you gave him an ISDRIVE() function!!! And you were in total | > agreement that different configs don't agree... <g> | | Ok, I'll repeat it again, NUL is bad for directories, NUL is good for | drives. I've yet to find the NUL trick to fail for drives (but I'm | sure someone out there can make it fail). +-[DP=>ID] Mmmm, I'll take you're word for it. +- | Anyway, I prefer your version, it's in the one true language. :-) +-[DP=>ID] Ahhh, now I can rest in peace... ;-) +- | > Having a nice day are we?... ;-) | | Every day is a nice day. <g> +-[DP=>ID] No, at the moment, every day is a hot and sticky one. And it's going to get hotter.... DrDebug . DBMR v1.00 . MrDebug - Simply the Best +----------------------------------+--------------------------------------+
| The Dark Knight Returns BBS | MrDebug product support: |
| and MrDebug for Windows | Fax&BBS: +44 (0)1480 471465 | |(MrDebug: THE CA-Clipper de{*filter*})| Tel: +44 (0)1480 403104 | +----------------------------------+--------------------------------------+
|
Tue, 05 Jan 1999 03:00:00 GMT |
|
 |
Maurice Uijlenbroe #13 / 13
|
 Check drive A
Quote:
> I'm using NFLIB3.5, wonder what's the version now?
For as far as I know, it's not changed ! Maurice.
|
Sun, 10 Jan 1999 03:00:00 GMT |
|
|