Issue with code?
#4
Count the lines in your output display.  It looks like FILES is printing something for each drive that you check for.

In your screenshot, "C:\USERS\BOB\QB64\SOURCE\FILE" is the last directory successfully listed.

It looks like the extra text lines are being printed by the FILES statement, with one line printed for each non-existent drive that the program checks for.

I added a line to your program, "Print "{{{ "; Drive$; " }}}", directly above the FILES line.  Screenshot of test run:
[Image: QB-BUGHUNT.png]

The PRINT statement tells us which drive is being checked for.
Note how FILES prints the name of the current working directory for each non-existent drive that it is run for.



Instead of FILES, you might try the _DIREXISTS function (https://qb64phoenix.com/qb64wiki/index.php/DIREXISTS), looking for "/" (the root directory) on each drive:
"A:/"
"B:/"
"C:/"
and so on. I'm using the forward slash (instead of the Windows-specific backslash) for multi-OS compatibility.

Here's a quick test, which works on my Win7 machine (although it does not show my DVD drive, E:, since that drive is empty):
Code: (Select All)
DefInt A-Z
found$ = ""
For test = Asc("A") To Asc("Z")
    lookfor$ = Chr$(test) + ":/"
    If _DirExists(lookfor$) Then found$ = found$ + Chr$(test)
Next
Print found$
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: 6 Guest(s)