Esempio n. 1
0
LPTSTR Camera::get_file_name(LPCTSTR from, LPCTSTR to) 
{
	int len; 
    StringW destinationString = convertToStringW(from);
	size_t found;
	len = destinationString.find_last_of('\\');
	LOG(INFO) + "Test Check: " + len;
	StringW name = destinationString.substr(len+1);
	int length1 = wcslen(name.c_str());
    wchar_t* returnName = (wchar_t*) malloc(length1*sizeof(wchar_t)+1); 
	wcscpy(returnName,name.c_str());
     len = wcslen(to);
	if (wcsncmp( to, from, len )!=0) 
    {
        StringW strPathTo = to;
        strPathTo += L"\\";
        strPathTo += name;

        if ( !copy_file( from, strPathTo.c_str() ) )
            return 0;
    } 
    if (wcsncmp( to, from, len )!=0) 
	{
		if( DeleteFile(from) != 0 )
    LOG(INFO) + "File Deletion Failed " ;
  else
    LOG(INFO) + "File Deleted Successfull " ;
	}

	return returnName;
}