LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetDiskSpace Toolbox problem

Hi,

I'm using CVI 6.0 and WINDOWS 2000

I'm having some problems to understand how the GetDiskSpace function works.

If I look the info of my HARD DRIVE with PARTITION MAGIC 7.0 I get:

DISK 1: 39,205.5 MB

I have two partition:
C: NTFS Pri,Boot 20,002.8 MB
😧 NTFS Log 19,194.8 MB

When I use the GetDiskSpace, the 64bit balue that I get for drive C: is 43794558976 wich is 43,794.5 MB

Its wrong and impossible, why do I get such a value ?

Can anyone help me with this ?, is there a better way to find out ?

Thank you,

Aldrin,
0 Kudos
Message 1 of 3
(3,494 Views)
/*Hi Aldrin,
if you go back a long ways in the newsgroup there is a posting by James Donahue on 5/17/2001,(that's where I got it)
I presume you have the toolbox.h header #included for the Int64Type struct definition
you need to convert the Int64Type to a double ( 0xFFFFFFFF + 1.0 is a convenient shorthand for 2^32)
like so:
suppose you have*/
UInt64Type l_bytes_free, l_tot_bytes;
double dBytesFree, dBytesTot;
//and you call
l_result = DirSelectPopup ("", "Select Directory", 0, 1, l_path);
SplitPath (l_path, l_drive, l_dir, l_fname);
GetDiskSpace (l_drive, &l_tot_bytes, &l_bytes_free);
//now convert the struct to double
dBytesFree = (double)l_bytes_free.loBytes + ((double)(l_bytes_free.hiBytes))*((double)(0xFFFFFFFF + 1.0));
dBytesTot = (double)
l_tot_bytes.loBytes + ((double)(l_tot_bytes.hiBytes))*((double)(0xFFFFFFFF + 1.0));
I tested this on W2KP and CVI6.0
cheers, HTH.
Message 2 of 3
(3,494 Views)
Hi,

Thank you very much, Its working 100% !

Best regards,

Adi,
0 Kudos
Message 3 of 3
(3,494 Views)