How much storage am I using?

I am using Objective-C to retrieve some information about the hard drive. I successfully retrieve the amount used in bytes.

However I am having trouble converting bytes to gigabytes. When doing this programatically, I get 76,768,641,024 bytes. I then convert this to GB: 76,768,641,024 bytes/(1024* 1024 * 1024) = 71.5 GB. My Mac reports the exact same amount of bytes. However it reports that this is equal to 76.77 GB!

Why is there a difference in GB if the amount of bytes is the same?

I am on a iMac running OSX Snowleopard.


Solution 1:

The difference is in your measurement. OSX is using the STANDARD measuring system.

1 GB (GigaBytes) = 1000 MB (MegaBytes)


The non-standard measurement used, for example, in Windows is:

1 GiB (GibiBytes) = 1024 MiB (MibiBytes)

http://en.wikipedia.org/wiki/Gibibyte