string FormatFileSize(unsigned int iFileSize)
{
char buff[100];
memset(buff , 0 , sizeof(buff));
if (iFileSize >= 1073741824)
{
snprintf(buff , sizeof(buff)-1 , "%.2fG" , iFileSize / 1073741824.0);
}
else if (iFileSize >= 1048576)
{
snprintf(buff , sizeof(buff)-1 , "%.2fM" , iFileSize / 1048576.0);
}
else if (iFileSize >= 1024)
{
snprintf(buff , sizeof(buff)-1 , "%.2fK" , iFileSize / 1024.0);
}
else
{
snprintf(buff , sizeof(buff)-1 , "%dB" , iFileSize);
}
return buff;
}