Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bytes to KB converter

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Do you ever need to express the size of a file in KB as opposed to bytes?

If so, see faq184-3055
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Chris,

I'm guessing the if... else segment is intended to differentiate between KB & MB, so the code could read:

Code:
FUNCTION Bytes2KB
LPARAMETERS nValue

lnKB = (nValue/1.024) / 1000

IF lnKB > 999.99
    RETURN TRANSFORM(CEILING(lnKB/1.024/1000),[999,999])+[MB]
ELSE
    RETURN TRANSFORM(CEILING(nValue/1.024/1000),[999,999])+[KB]
ENDI
Regards

Griff
Keep [Smile]ing
 
Griff

Thanks for spotting the typo!

It will be corrected.
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top