07-29-2022, 09:13 AM
I am writing a small sub to gather the available drives on a system (windows) and I am getting spurious items printed on to the console window. There are no print statements so the screen should be blank
When using $Debug to watch execution, I get program crashes and windows messages that a problem has caused the program to stop working correctly.
Not sure what is happening here, but it looks like a memory issue.
Code: (Select All)
Dim Shared Drive$
Dim Shared DrvErr
Dim Shared DriveName$(27)
Dim Shared DriveNum%
DECLARE SUB FindDrives () '*** Find which drives are on the PC ***
FindDrives
'For x% = 1 To DriveNum%
' Print DriveName$(x%)
'Next x%
'End
DriveErr:
If Err = 68 Then ProgErr = 1
DrvErr = 1
Resume Next
End
Sub FindDrives
DriveNum% = 0
'*** Find what drives are present in the PC ***
Erase DriveName$
On Error GoTo DriveErr
For Count = 65 To 90
DrvErr = 0
Drive$ = Chr$(Count) + ":\"
Files Drive$
If DrvErr = 0 Then
DriveNum% = DriveNum% + 1
DriveName$(DriveNum%) = Chr$(Count)
End If
Next Count
End Sub
When using $Debug to watch execution, I get program crashes and windows messages that a problem has caused the program to stop working correctly.
Not sure what is happening here, but it looks like a memory issue.