- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
BOOLEAN ConvertSizeToStr(__int64 size,TCHAR *buf,DWORD buf_size_c)
{
double dsize;
HRESULT hr;
dsize=(double)size;
if (size/1500000000000L>0)
{
dsize/=1099511627776L;
hr=StringCchPrintf(buf,buf_size_c,_T("%.2lf Тб"),dsize);
}
else if (size/1500000000L>0)
{
dsize/=1073741824L;
hr=StringCchPrintf(buf,buf_size_c,_T("%.2lf Гб"),dsize);
}
else if (size/1500000L>0)
{
dsize/=1048576L;
hr=StringCchPrintf(buf,buf_size_c,_T("%.2lf Мб"),dsize);
}
else if (size/1500>0)
{
dsize/=1024;
hr=StringCchPrintf(buf,buf_size_c,_T("%.2lf Кб"),dsize);
}
else
hr=StringCchPrintf(buf,buf_size_c,_T("%I64d байт"),size);
if (SUCCEEDED(hr))
return true;
else
return false;
}