Copy file and also set destination file's attribute
BOOL FileCopy( LPCSTR lpcszSrc, LPCSTR lpcszDest, DWORD dwAttribute = FILE_ATTRIBUTE_NORMAL, bool bSetCurrentTime = false )
Returns TRUE for success, otherwiseFALSE.
EX1
int FileCopy_ex1() { string strExePath = GetAppPath(); if( strExePath.IsEmpty()) return 1; StringArray saResult; FindFiles(saResult, strExePath, "txt"); if( saResult.GetSize() > 0) { string strCopyFrom=strExePath+saResult[0], strCopyTo=strExePath+"temp.txt"; FileCopy(strCopyFrom,strCopyTo,FILE_ATTRIBUTE_NORMAL,true); printf("the new file is created in %s",GetFileModificationDate(strCopyTo)); } return 0; }
This function will call CopyFile with default bFailIfExists = FALSE
origin.h