Well, sorry, I was busy and then lazy up to this morning to draw a small sample code.
This is there something I meant by using large integers returned from API functions. In this sample code I use the volume extended information, returning bytes numbers larger than 2GB.
It works easy and can be processed in any program I guess (but only Windows API. I don't know about other platforms).
Note that I show float recalculted values just for understanding on how to display it, as it is not necessary to convert large integers values to floats for comparison.
Then you can look forward in using other file or filesystem commands to process file size or directory size comparizons.
Tell me if you are on the way with this.
Code: Select all
;
; ULARGE_INTEGER is part of API structures integrated in Purebasic
;
;Structure ULARGE_INTEGER
; LowPart.l
; HighPart.l
;EndStructure
DirectoryName.s = "C:\"
; returns 1 if processed well
Debug GetDiskFreeSpaceEx_(@DirectoryName, @FreeBytesAvailableToCaller.ULARGE_INTEGER, @TotalNumberOfBytes.ULARGE_INTEGER, @TotalNumberOfFreeBytes.ULARGE_INTEGER)
; returns HighPart * $100000000 + LowPart value
Debug FreeBytesAvailableToCaller\LowPart
Debug FreeBytesAvailableToCaller\HighPart
f.f = FreeBytesAvailableToCaller\HighPart * $10000 * $10000 + FreeBytesAvailableToCaller\LowPart
Debug f
; idem
Debug TotalNumberOfBytes\LowPart
Debug TotalNumberOfBytes\HighPart
f.f = TotalNumberOfBytes\HighPart * $10000 * $10000 + TotalNumberOfBytes\LowPart
Debug f
; idem
Debug TotalNumberOfFreeBytes\LowPart
Debug TotalNumberOfFreeBytes\HighPart
f.f = TotalNumberOfFreeBytes\HighPart * $10000 * $10000 + TotalNumberOfFreeBytes\LowPart
Debug f
CallDebugger
End
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.