I have a problem when copying an ".mdb" file (Microsoft Access) with the function "movefile".
I use a C++ visual studio 2010 program. Code :
strTxt1 = "g:\\temp\\toto.mdb";
strTxt2 = "g:\\temp\\tata.mdb";
if (!::MoveFile (strTxt1, strTxt2))
{
CString strError;
int iLastError = GetLastError();
strError.Format(_T("Error --> %d"), iLastError);
AfxMessageBox(strError);
}
Error :
I already check this post : C++ MoveFile giving ERROR_ACCESS_DENIED inconsistently for directory moves on Windows Server
I already try the MoveFileEx alternative but i have the same problem.
Remarques :
1- when i disable my antivirus, I don't have this problem
2- If I put a breakpoint at the start of the error block (CString strError;) and I manually replay the movefile instruction after a short wait (2 seconds) the movefile executes normally.
I'm sure it comes from my antivirus, but I haven't found a way to prove it "formally". I have already visited the log files of my antivirus, nothing is reported.