zoukankan
html css js c++ java
MFC 的几个常用函数,用来计算文件大小,下载速度,转换时间的
//获取文件的大小,并以KB 或 MB 来表示 CString GetFileSize(LONG size) { CString _size; //判断大小有没有超过1 if (size<(1024*1024)) { _size.Format("%.2lfKB",size/1024.0); }else if(1024*1024*1024) { _size.Format("%.2lfMB",(size/1024.0)/1024.0); }else { _size.Format("%.2lfGB",(size/1024.0/1024.0)/1024.0); } return _size; } //获取下载速度的字符串 CString GetFileTranSpeed(DWORD size,DWORD time) { CString _speed; //判断时间是否为0 if (time>0){ if (size/1024*1000.0/time<1024) { _speed.Format("%.2lfKB/s",size/1024*1000.0/time); }else { _speed.Format("%.2lfMB/s",(size/1024)*1000.0/time); } }else { return _speed = "0KB/s"; } return _speed; } //获取时间的字符串 CString GetTimeFormatStr(LONG time) { CString _time; int hh = time/3600; int mm = (time-hh*3600)/60; int ss = time%60; _time.Format("%d%d:%d%d:%d%d",hh/10,hh%10,mm/10,mm%10,ss/10,ss%10); return _time; }
查看全文
相关阅读:
cs11_c++_lab4a
cs11_c++_lab3
cs11_c++_lab2
cs11_c++_lab1
Oracle 11.2.4.0 ACTIVE DATAGUARD 单实例安装(COPY创建备库)
无备份恢复(归档模式)
rman datafile恢复(归档模式)
GHOST(幽灵)重大漏洞
Windows Linux 之间rsync同步CODE文件
Centos 6.5 SNMP客户端安装及配置版本net-snmp-5.7.3
原文地址:https://www.cnblogs.com/javawebsoa/p/2458432.html
最新文章
用Peach Fuzz PNG文件
duilib属性
使用_CRTDBG_LEAK_CHECK_DF检查VC程序的内存泄漏(转)
duilib入门问题集
VS中的路径宏 vc++中OutDir、ProjectDir、SolutionDir各种路径
逻辑坐标系 设备坐标系 客户坐标系 屏幕坐标系
解析SQLite中的常见问题与总结详解
VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall
C++模板
ios基础笔试题-集锦二
热门文章
iOS基础笔试题
docker help
cs107
CString转string
c++注意事项
cs11_adventure c++_lab1
cs11_c++_lab7
cs11_c++_lab6
cs11_c++_lab5待修改
cs11_c++_lab4b
Copyright © 2011-2022 走看看