Correct way to convert size in bytes to KB, MB, GB Delphi -


what correct way convert size in bytes kb, mb, gb in delphi.

i suppose want delphi solution. try this

uses   math; function convertbytes(bytes: int64): string; const   description: array [0 .. 8] of string = ('bytes', 'kb', 'mb', 'gb', 'tb', 'pb', 'eb', 'zb', 'yb'); var   i: integer; begin   := 0;    while bytes > power(1024, + 1)     inc(i);    result := formatfloat('###0.##', bytes / intpower(1024, i)) + ' ' + description[i]; end; 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -