Thread: [Dev-C++] GetDiskFreeSpaceEx Question
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Hammamur R. <hra...@ho...> - 2003-03-22 09:38:13
|
Hi, Im using the following function: GetDiskFreeSpaceEx(&szDrives[i], &uliFreeCaller, &uliTotal, &uliFree) The uliFreeCaller, uliTotal, uliFree are all of type ULARGE_INTEGER. Now I need these values as normal integer so I could pass these values to another function which only accepts normal integer values. How could I convert them to normal integer, do I have to cast them. Please help. Thank You! _________________________________________________________________ Use MSN Messenger to send music and pics to your friends http://messenger.msn.co.uk |
|
From: Per W. <pw...@ia...> - 2003-03-22 10:39:45
|
You might use the uliFreeCaller.QuadPart value, which is a 64-bit integer. Or, if you know that the information is < 4GB, you have a 32-bit value in uliFreeCaller.LowPart. Note that since a HD normally is larger than 4 GB, you may not assume that you might send the information to a function that only accepts a 'normal integer value'. A little improvement would be to Rewrite your function to assume space in kB units, and then you call it with: =09MyFunction(unsigned(uliFreeCaller.QuadPart / 1024)); That would be safe up to 4TB disks. /Per W On Sat, 22 Mar 2003, Hammamur Rahman wrote: > > > Hi, I=92m using the following function: > > GetDiskFreeSpaceEx(&szDrives[i], &uliFreeCaller, &uliTotal, &uliFree) > > > > The uliFreeCaller, uliTotal, uliFree are all of type ULARGE_INTEGER. Now= I > need these values as normal integer so I could pass these values to anoth= er > function which only accepts normal integer values. How could I convert t= hem > to normal integer, do I have to cast them. Please help. > > > > Thank You! > > > > > _________________________________________________________________ > Use MSN Messenger to send music and pics to your friends > http://messenger.msn.co.uk > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Hammamur R. <HRa...@ho...> - 2003-03-22 19:58:46
|
Hi, thank you for your help! I have now used the QuadPart, I written a test program to see what values I get with using the variables with the QuadPart and without. All of my partition output the same size, but one outputs different, i.e. the uliFree is returning different values to uliFree.QuadPart. I think I know what the problem is. The partition outputting different values has got more then 4 gigs free, all the other partitions have got less then 2 gigs free. Could you please tell me how I can fix this, I tried to follow the Microsoft site, but got more confused. Thank You! -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Per Westermark Sent: 22 March 2003 11:38 To: Hammamur Rahman Cc: dev...@li... Subject: Re: [Dev-C++] GetDiskFreeSpaceEx Question You might use the uliFreeCaller.QuadPart value, which is a 64-bit integer. Or, if you know that the information is < 4GB, you have a 32-bit value in uliFreeCaller.LowPart. Note that since a HD normally is larger than 4 GB, you may not assume that you might send the information to a function that only accepts a 'normal integer value'. A little improvement would be to Rewrite your function to assume space in kB units, and then you call it with: MyFunction(unsigned(uliFreeCaller.QuadPart / 1024)); That would be safe up to 4TB disks. /Per W On Sat, 22 Mar 2003, Hammamur Rahman wrote: > > > Hi, I'm using the following function: > > GetDiskFreeSpaceEx(&szDrives[i], &uliFreeCaller, &uliTotal, &uliFree) > > > > The uliFreeCaller, uliTotal, uliFree are all of type ULARGE_INTEGER. Now I > need these values as normal integer so I could pass these values to another > function which only accepts normal integer values. How could I convert them > to normal integer, do I have to cast them. Please help. > > > > Thank You! > > > > > _________________________________________________________________ > Use MSN Messenger to send music and pics to your friends > http://messenger.msn.co.uk > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > ------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Per W. <pw...@ia...> - 2003-03-22 22:12:23
|
Actually, there isn't much you can do. - Modify the receiving function to take a 64-bit parameter. Don't worry about portability since you are anyway using a Win32-specific function to retrieve the value. - Modify the receiving function to take a scaled (kB maybe) value. - Modify function to take two params. High + low. Not a nice solution. There really isn't any other way since real partitions normally are larger than 4GB, i.e. need more than 32-bit to represent size. /Per W On Sat, 22 Mar 2003, Hammamur Rahman wrote: > Hi, thank you for your help! > > I have now used the QuadPart, I written a test program to see what > values I get with using the variables with the QuadPart and without. > All of my partition output the same size, but one outputs different, > i.e. the uliFree is returning different values to uliFree.QuadPart. I > think I know what the problem is. The partition outputting different > values has got more then 4 gigs free, all the other partitions have got > less then 2 gigs free. > > Could you please tell me how I can fix this, I tried to follow the > Microsoft site, but got more confused. > > Thank You! > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Per > Westermark > Sent: 22 March 2003 11:38 > To: Hammamur Rahman > Cc: dev...@li... > Subject: Re: [Dev-C++] GetDiskFreeSpaceEx Question > > You might use the uliFreeCaller.QuadPart value, which is a 64-bit > integer. > > Or, if you know that the information is < 4GB, you have a 32-bit value > in > uliFreeCaller.LowPart. > > Note that since a HD normally is larger than 4 GB, you may not assume > that > you might send the information to a function that only accepts a 'normal > integer value'. > > A little improvement would be to Rewrite your function to assume space > in > kB units, and then you call it with: > MyFunction(unsigned(uliFreeCaller.QuadPart / 1024)); > > That would be safe up to 4TB disks. > > /Per W > > > On Sat, 22 Mar 2003, Hammamur Rahman wrote: > > > > > > > Hi, I'm using the following function: > > > > GetDiskFreeSpaceEx(&szDrives[i], &uliFreeCaller, &uliTotal, &uliFree) > > > > > > > > The uliFreeCaller, uliTotal, uliFree are all of type ULARGE_INTEGER. > Now I > > need these values as normal integer so I could pass these values to > another > > function which only accepts normal integer values. How could I > convert them > > to normal integer, do I have to cast them. Please help. > > > > > > > > Thank You! > > > > > > > > > > _________________________________________________________________ > > Use MSN Messenger to send music and pics to your friends > > http://messenger.msn.co.uk > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by:Crypto Challenge is now open! > > Get cracking and register here for some mind boggling fun and > > the chance of winning an Apple iPod: > > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |