How do you make a physical copy of a file through CFile class?
-
The scenario is that I have a file xyz.ini and I want to make a backup of it called xyz.ini2 and then rewrite to xyz. I have tried CFile::Rename and CFile::Duplicate and I am getting "a sharing violation occured while accessing an unnamed file". CFile temporiginifile; temporiginifile.Open(m_sFileFullPathName,CFile::modeReadWrite|CFile::shareDenyNone); temporiginifile.Rename(m_sFileFullPathName,m_sFileFullPathName+"2"); temporiginifile.Close(); Paradise is where I am. Voltaire
-
The scenario is that I have a file xyz.ini and I want to make a backup of it called xyz.ini2 and then rewrite to xyz. I have tried CFile::Rename and CFile::Duplicate and I am getting "a sharing violation occured while accessing an unnamed file". CFile temporiginifile; temporiginifile.Open(m_sFileFullPathName,CFile::modeReadWrite|CFile::shareDenyNone); temporiginifile.Rename(m_sFileFullPathName,m_sFileFullPathName+"2"); temporiginifile.Close(); Paradise is where I am. Voltaire
Just use CopyFile API function. All you need to do is to pass the filenames. Tomasz Sowinski -- http://www.shooltz.com
-
Just use CopyFile API function. All you need to do is to pass the filenames. Tomasz Sowinski -- http://www.shooltz.com