用SetStatus()设置文件信息是出现异常:在存取一未命名文件时发生共享违例.
这是什么原因?
if (!sourceFile.Open(operInfo.left.m_strPath, CFile::modeRead |
CFile::shareDenyWrite , NULL) )
{
AfxMessageBox(_T("打开文件失败"));
return FALSE;
} if(!destFile.Open(operInfo.right.m_strPath,
CFile::modeWrite | CFile::modeCreate, NULL))
{
AfxMessageBox(_T("打开文件失败"));
return FALSE;
} CFileStatus status;
if (sourceFile.GetStatus(status))
{
CFile::SetStatus(operInfo.right.m_strPath, status);
}
这是什么原因?
if (!sourceFile.Open(operInfo.left.m_strPath, CFile::modeRead |
CFile::shareDenyWrite , NULL) )
{
AfxMessageBox(_T("打开文件失败"));
return FALSE;
} if(!destFile.Open(operInfo.right.m_strPath,
CFile::modeWrite | CFile::modeCreate, NULL))
{
AfxMessageBox(_T("打开文件失败"));
return FALSE;
} CFileStatus status;
if (sourceFile.GetStatus(status))
{
CFile::SetStatus(operInfo.right.m_strPath, status);
}
sourceFile.Close(); CFileStatus status;
if (CFile::GetStatus(m_strPath, status))
{
CFile::SetStatus(m_strPath, status);
}