Converting bytes

new topic     » topic index » view thread      » older message » newer message

I'm reading my drives and folders.

UDED=CAPACITY-FREE

All the answers in bytes.

What's the formula to convert them to Gigs, Megs, or Ks, whichever is appropriate? if amt>gig then if amt>K then if amt>MEG then end if

I am confused by the following:

Name A Bin Pwr Binary Value Decimal Power Decimal Value
Kilobyte KB 2^10 1,024 10^3 1000
Megabyte Mb 2^20 1,048,576 10^6 1,000.000
Gigabyte GB 2^30 1,073,741,825 10^9 1,000,000,000
Terabyte TB 2^40 1,099,511,627,776 10^12 1,000,000,000,000

GIG,MEG,K to represent Binary Values
and gig,meg,k to represent Decimal Values

if amt>GIG then 
	--GIG handling routine 
elsif amt>MEG   then 
	--MEG handling routine 
elsif amt>K then 
	--K handling routine 
end if 
 

also I could

if amt>gig then 
	--gig handling routine 
elsif amt>meg then 
	--meg handling routine 
elsif amt>k then 
	--k handling routine 
end if 
 

This is as far as I can get.

I don't know where to start .

Don Cole

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu