#pragma once namespace DVLib { //Equivalente di StrFormatByteSizeA (che per� non � supportata in Win95) // 532 -> 532 bytes // 1340 -> 1.3KB // 23506 -> 23.5KB // 2400016 -> 2.4MB //2400000000 -> 2.4GB inline CString FormatNumberToBytes(ULONG p_Bytes) { CString tmp; if (p_Bytes < 1024) //bytes tmp.Format("%lu", p_Bytes); else if (p_Bytes < (1048576) ) //Kb tmp.Format("%.2fKB ", (double)p_Bytes/1024.0 ); else if (p_Bytes < (1073741824) ) //Mb tmp.Format("%.2fMB", (double)p_Bytes/1048576.0 ); else if (p_Bytes < (1099511627776) ) //GB tmp.Format("%.2fGB", (double)p_Bytes/1073741824.0 ); else tmp.Format("%lu", p_Bytes); return tmp; } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The MIT License