vs2010 MFC 设计了一个多线程 进入线程就卡死不动 纠结啊
代码如下大神们帮帮我!!UINTThreadFunc(LPVOIDda){BYTEbuffer[512];ULONGLONGfilelenth;try{CFileoldf...
代码如下 大神们 帮帮我!!
UINT ThreadFunc(LPVOID da)
{
BYTE buffer[512];
ULONGLONG filelenth;
try{
CFile oldfile(_T("Data\\Waterctl.mdb"),CFile::modeRead);
filelenth = oldfile.GetLength();
threadinfo* path = (threadinfo*)da;
ULONGLONG posta=filelenth/51200;
int i=0;
CFile newfile(path->strFilePath,CFile::modeReadWrite|CFile::modeCreate);
while(filelenth>512)
{
oldfile.Read(buffer,sizeof(buffer));
newfile.Write(buffer,sizeof(buffer));
filelenth-=512;
i+=512;
if(i%posta==0)
postion++;
Sleep(1);
}
oldfile.Read(buffer,filelenth);
newfile.Write(buffer,filelenth);
postion=99;
oldfile.Close();
newfile.Close();
}
catch(CFileException* e)
{
e->ReportError();
e->Delete();
}
return 0;
} 展开
UINT ThreadFunc(LPVOID da)
{
BYTE buffer[512];
ULONGLONG filelenth;
try{
CFile oldfile(_T("Data\\Waterctl.mdb"),CFile::modeRead);
filelenth = oldfile.GetLength();
threadinfo* path = (threadinfo*)da;
ULONGLONG posta=filelenth/51200;
int i=0;
CFile newfile(path->strFilePath,CFile::modeReadWrite|CFile::modeCreate);
while(filelenth>512)
{
oldfile.Read(buffer,sizeof(buffer));
newfile.Write(buffer,sizeof(buffer));
filelenth-=512;
i+=512;
if(i%posta==0)
postion++;
Sleep(1);
}
oldfile.Read(buffer,filelenth);
newfile.Write(buffer,filelenth);
postion=99;
oldfile.Close();
newfile.Close();
}
catch(CFileException* e)
{
e->ReportError();
e->Delete();
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询