QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: Mad Axeman on April 02, 2021, 05:04:33 pm
-
Hi Folks
My brain has gone totally blank on this. Is there a simple way to find out how much free space there is on a drive ? I know I can pipe a DIR output to a file and read that in but surely there's a nice built in command to get the free space or am I just imagining it ??
-
@Mad Axeman
Maybe of use to you?
Reply #85 https://www.qb64.org/forum/index.php?topic=2276.75
-
uni$ = "C"
R = GetDiskFreeSpaceExA(uni$ + ":\" + CHR$(0), free~&&, total~&&, free2~&&)
IF R THEN
vo$ = STR$(free~&&): vo1$ = STR$(total~&&)
PRINT "Free space = "; vo$: PRINT "Total space = "; vo1$
INPUT k$
END IF
END
'qb64 x64
DECLARE DYNAMIC LIBRARY "kernel32"
FUNCTION GetDiskFreeSpaceExA& (filename$, free AS _UNSIGNED _INTEGER64, total AS _UNSIGNED _INTEGER64, free2 AS _UNSIGNED _INTEGER64)
END DECLARE
-
Yeah both euclides and spriggsy works (Windows 10), don't know why euclides has INPUT k$ unless using that as SLEEP function.
With Spriggsy's you might not want to test drive L:
I always thought you had to do the Declares first.
-
Thanks for the replies. All sorted now. I was a bit worried about euklides post as it mentions QB64 x64 and I'm running the prog I'm writing on a 32 bit Win7 PC but it works fine.
Isn't it about time QB64 had it's own keyword for this? It's useful to know how much drive space you have when you are writing what could maybe become very large files.