//得到系统时间
SYSTEMTIME systime;
GetLocalTime(&systime);
CString dwStart;
dwStart.Format("%d%d%d%d ",systime.wHour,systime.wMinute,systime.wSecond,systime.wMilliseconds);//每次读1024字节
num=myFile.Read(m_buf, SIZEFILE);
if(num==0) break;
//发送1024字节
end = send(pDlg->sockb,m_buf,num,0);
Sleep(1);//把这一行删掉程序运行时崩溃
//得到系统时间
CString dwEnd;
GetLocalTime(&systime);
dwEnd.Format("%d%d%d%d ",systime.wHour,systime.wMinute,systime.wSecond,systime.wMilliseconds);
//计算每秒的发送字节
int a=atol(dwStart);
int b=atol(dwEnd);
int c=1000/(b-a);
CString strTimeint;
strTimeint.Format("每秒传送 %dKB",c);
//发给全局变量
strName=strTimeint;请专家帮忙给更正一下
谢谢了
SYSTEMTIME systime;
GetLocalTime(&systime);
CString dwStart;
dwStart.Format("%d%d%d%d ",systime.wHour,systime.wMinute,systime.wSecond,systime.wMilliseconds);//每次读1024字节
num=myFile.Read(m_buf, SIZEFILE);
if(num==0) break;
//发送1024字节
end = send(pDlg->sockb,m_buf,num,0);
Sleep(1);//把这一行删掉程序运行时崩溃
//得到系统时间
CString dwEnd;
GetLocalTime(&systime);
dwEnd.Format("%d%d%d%d ",systime.wHour,systime.wMinute,systime.wSecond,systime.wMilliseconds);
//计算每秒的发送字节
int a=atol(dwStart);
int b=atol(dwEnd);
int c=1000/(b-a);
CString strTimeint;
strTimeint.Format("每秒传送 %dKB",c);
//发给全局变量
strName=strTimeint;请专家帮忙给更正一下
谢谢了
用1024除以接收数据之后的时间减去接受数据之前的时间差,得到的商乘以1000
因为时间单位为毫秒
因为下面的程序用了0毫秒的时间
//每次读1024字节
num=myFile.Read(m_buf, SIZEFILE);
if(num==0) break;
//发送1024字节
end = send(pDlg-> sockb,m_buf,num,0); 1000/0/程序崩溃
请问如何解决?