Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: motorollin on August 30, 2006, 07:31:14 AM
-
I have already mentioned this in another thread but thought I would start a new one as it's a new problem.
I'm using DosElmoreLib to try and get a list of volumes and their sizes. I'm having problems with the DiskUsed function, in that it returns a value which is far too small. For example:
AnalyzeDisk "HD1:"
Print DiskUsed
returns a negative value!
The partition is 16GB in size and has just over 2GB of data on it. I don't know if that's anything to do with the problem. I ran the same routine on HD0: which is 1GB in size and has 27MB of data on it, and it correctly reported the amount of used space on the drive. However, I also get negative values from RAM: and DF0:.
Is this a bug, or am I doing something wrong? I'm using OS3.9 if that makes any difference.
--
moto
-
It calculates the disk size using signed 32bit math. If the partition size is >2GB it b0rks.
However, I also get negative values from RAM: and DF0:.
Well, if that happens then the routine is broken even more ways than just 32bit signed math.
-
I thought as much. Do you now of any other way to find the used space on the volume, other than parsing the output from C:info for the number of used blocks and multiplying by the blocksize of the partition?
--
moto
-
Call dos.library/Info() yourself and use 64bit math to calculate sizes.
-
Ok, thanks for the tip. I'll do some research and find out what I need to do to call the library function, and the syntax of the info() function.
--
moto
-
Right, I don't have a clue how you can do that in Blitz, anyway. Maybe someone with a blitz clue could help?