Rename a file with full path specified for both old and new file names The old file name must point to a valid file that can be renamed and the new file name specified must be a full path in the same folder as the original.
BOOL RenameFile( LPCSTR lpcszNewFilename, LPCSTR lpcszOldFilename )
TRUE if success
EX1
void RenameFile_ex1() { string str = GetAppPath() + "origin.ini"; CopyFile(str, GetAppPath() + "junk1.ini"); string strNewName = GetAppPath() + "junk2.ini"; ASSERT(!strNewName.IsFile()); RenameFile(strNewName, GetAppPath() + "junk1.ini"); ASSERT(strNewName.IsFile()); }
origin.h