• 0

[VB.Net 2003] Number data types + rounding


Question

Hi there!

I am developing an application in VB.Net 2003 that is somewhat like Windows Explorer, but it also tells you the size of folders, not only files.

I know there are many apps like this around, but I decided to do my own ;)

However, I've got some questions for you.

I keep the size of files and folders in inherited treenodes that add some properties to the common treenode.

There two of the properties hold the size of the file/folder: one is in bytes, and another is in Bytes/KB/MBytes/Gbytes/Etc - it keeps reducing until it is < 1024. 1024Bytes, for instance, would be automatically reduced to 1Kbyte.

My questions are:

1) What is the best data type to hold the size in Bytes? Remember todays disks are getting bigger and bigger, and one single directory can contain hundreds of gigabytes.

2) What is the best data type to contain the "reduced" size? The way i have it now, reducedsize=sizeinbytes and in a "do until reducedsize<1024" loop i keep dividing it by 1024.

Also, I would like the reduced size to be rounded meaning it has to support decimal places. That is, 4 GB is VERY different from 4,89 GB.

Thank you for your time!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Yeah a UInt64 will last you up to 18446744073709551615 which (I think) is pleanty. :)

EDIT: also im not sure.. but I think a sector on a disk isnt always 1024?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.