07-29-2022, 12:16 PM
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.
On my system it prints:
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.
GuiTools, Blankers & other Projects:
https://staging.qb64phoenix.com/forumdisplay.php?fid=32
Libraries & useful Functions:
https://staging.qb64phoenix.com/forumdisplay.php?fid=23
https://staging.qb64phoenix.com/forumdisplay.php?fid=32
Libraries & useful Functions:
https://staging.qb64phoenix.com/forumdisplay.php?fid=23