Issue with code?
#2
If you are not depend, that your programs are Linux/Mac compatible, but working on Windows only, then you may use a WinAPI call and do some bit puzzeling.

Code: (Select All)
DECLARE LIBRARY
    FUNCTION GetLogicalDrives& ()
END DECLARE

'Find all currently available drives in one compact string.
PRINT CurrDrives$

'Test for a particular drive.
IF INSTR(CurrDrives$, "E") > 0 THEN
    PRINT "Drive E: is available."
ELSE
    PRINT "Drive E: is not available."
END IF
END

FUNCTION CurrDrives$
cdm& = GetLogicalDrives&
drives$ = "": i& = (2 ^ 25): d% = ASC("Z")
DO
    IF (cdm& AND i&) THEN drives$ = CHR$(d%) + drives$
    i& = i& \ 2: d% = d% - 1
LOOP UNTIL i& = 0
CurrDrives$ = drives$
END FUNCTION

On my system it prints:
Quote:CDEF
Drive E: is available.
Reply


Messages In This Thread
Issue with code? - by bobkreid - 07-29-2022, 09:13 AM
RE: Issue with code? - by RhoSigma - 07-29-2022, 12:16 PM
RE: Issue with code? - by bobkreid - 07-29-2022, 02:43 PM
RE: Issue with code? - by JRace - 07-29-2022, 03:00 PM
RE: Issue with code? - by Pete - 07-29-2022, 05:40 PM
RE: Issue with code? - by JRace - 07-29-2022, 06:02 PM
RE: Issue with code? - by Pete - 07-29-2022, 06:24 PM
RE: Issue with code? - by SMcNeill - 07-29-2022, 06:50 PM
RE: Issue with code? - by Pete - 07-29-2022, 07:23 PM
RE: Issue with code? - by SMcNeill - 07-29-2022, 07:31 PM
RE: Issue with code? - by Pete - 07-29-2022, 07:56 PM
RE: Issue with code? - by bobkreid - 07-30-2022, 03:12 PM
RE: Issue with code? - by Pete - 07-30-2022, 04:02 PM
RE: Issue with code? - by JRace - 07-30-2022, 03:48 PM



Users browsing this thread: 9 Guest(s)