BOOL CXXXDlg::CopyHostFile(const CString &Source, const CString &Des)
{
CFile m_ReadFile, m_WriteFile;
try
{
m_ReadFile.Open(Source, CFile::modeRead);
try
{
m_WriteFile.Open(Des, CFile::modeCreate | CFile::modeWrite);
TCHAR szBuff[1024] = {0};
int ReadSize = 0;
while(ReadSize = m_ReadFile.Read(szBuff, 1024))
{
m_WriteFile.Write(szBuff, ReadSize);
}
}
catch (CFileException *e)
{
m_ReadFile.Close();
m_WriteFile.Close();
e->ReportError();
e->Delete();
return FALSE;
}
}
catch (CFileException *e)
{
m_ReadFile.Close();
e->ReportError();
e->Delete();
return FALSE;
}
m_ReadFile.Close();
m_WriteFile.Close();
return TRUE;
}
{
CFile m_ReadFile, m_WriteFile;
try
{
m_ReadFile.Open(Source, CFile::modeRead);
try
{
m_WriteFile.Open(Des, CFile::modeCreate | CFile::modeWrite);
TCHAR szBuff[1024] = {0};
int ReadSize = 0;
while(ReadSize = m_ReadFile.Read(szBuff, 1024))
{
m_WriteFile.Write(szBuff, ReadSize);
}
}
catch (CFileException *e)
{
m_ReadFile.Close();
m_WriteFile.Close();
e->ReportError();
e->Delete();
return FALSE;
}
}
catch (CFileException *e)
{
m_ReadFile.Close();
e->ReportError();
e->Delete();
return FALSE;
}
m_ReadFile.Close();
m_WriteFile.Close();
return TRUE;
}