您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CopyFileW函数代码示例

51自学网 2021-06-01 20:13:44
  C++
这篇教程C++ CopyFileW函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CopyFileW函数的典型用法代码示例。如果您正苦于以下问题:C++ CopyFileW函数的具体用法?C++ CopyFileW怎么用?C++ CopyFileW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CopyFileW函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Sleep

	/*!	 * Copies file from source path to destination.	 *	 * @param sourceFilename Path to the file.	 * @param destFilename Destination file path.	 * @param doOverwrite Do overwrite destination file if it exists.	 * @returns True if file was successfully moved.	 */	GDAPI bool FileUtilitiesWindows::FileCopy(WideString const& sourceFilename, WideString const& destFilename, bool const doOverwrite /*= false*/)	{		auto const sourceFilenameSystem = Paths::Platformize(sourceFilename);		auto const destFilenameSystem = Paths::Platformize(destFilename);		if (CopyFileW(sourceFilenameSystem.CStr(), destFilenameSystem.CStr(), !doOverwrite) == FALSE)		{			Sleep(0);			return CopyFileW(sourceFilenameSystem.CStr(), destFilenameSystem.CStr(), !doOverwrite) == TRUE;		}		return true;	}
开发者ID:GoddamnIndustries,项目名称:GoddamnEngine,代码行数:19,


示例2: FixAutoplay

void FixAutoplay( LPCWSTR wszApplicationName, LPCWSTR wszCommandLine, LPCWSTR wszCurrentDirectory ){	LPCWSTR uppApplicationName = _wcsupr( _wcsdup( wszApplicationName ) );	// only UT2004	if( wcsstr(uppApplicationName,L"UT2004.EXE") == NULL )		return;	// read mod name from commandline, must be specified	LPCWSTR uppCommandLine = _wcsupr( _wcsdup( wszCommandLine ) );	LPWSTR pb = wcsstr(uppCommandLine,L"-MOD=");	if( pb == NULL )		return;		// mod name must be valid	LPWSTR ps = pb + wcslen(L"-MOD=");	LPWSTR token = wcstok( ps, L" " );	if( token == NULL )		return;	// mod directory must be valid	if( !SetCurrentDirectoryW(wszCurrentDirectory)	||	!SetCurrentDirectoryW(L"..")	||	!SetCurrentDirectoryW(token) )		return;	// copy Autoplay.ut2	if( !CopyFileW( L"..//Maps//Autoplay.ut2", L"Maps//Autoplay.ut2", FALSE ) )		return;	//MessageBox( NULL, TEXT("Copy OK"), TEXT("SwAutoplayFix"), MB_OK );}
开发者ID:roman-dzieciol,项目名称:SwAutoplayFix,代码行数:32,


示例3: CopyFolder

bool CopyFolder(std::wstring src, std::wstring dst){	if(!os_create_dir(dst))		return false;	std::vector<SFile> curr_files=getFiles(src);	for(size_t i=0;i<curr_files.size();++i)	{		if(curr_files[i].isdir)		{			bool b=CopyFolder(src+os_file_sep()+curr_files[i].name, dst+os_file_sep()+curr_files[i].name);			if(!b)				return false;		}		else		{			if(!os_create_hardlink(dst+os_file_sep()+curr_files[i].name, src+os_file_sep()+curr_files[i].name, false, NULL) )			{				BOOL b=CopyFileW( (src+os_file_sep()+curr_files[i].name).c_str(), (dst+os_file_sep()+curr_files[i].name).c_str(), FALSE);				if(!b)				{					return false;				}			}		}	}	return true;}
开发者ID:Averroes,项目名称:urbackup_backend,代码行数:29,


示例4: BLI_copy

int BLI_copy(const char *file, const char *to){	int err;	/* windows doesn't support copying to a directory	 * it has to be 'cp filename filename' and not	 * 'cp filename destdir' */	BLI_strncpy(str, to, sizeof(str));	/* points 'to' to a directory ? */	if (BLI_last_slash(str) == (str + strlen(str) - 1)) {		if (BLI_last_slash(file) != NULL) {			strcat(str, BLI_last_slash(file) + 1);		}	}	UTF16_ENCODE(file);	UTF16_ENCODE(str);	err = !CopyFileW(file_16, str_16, false);	UTF16_UN_ENCODE(str);	UTF16_UN_ENCODE(file);	if (err) {		callLocalErrorCallBack("Unable to copy file!");		printf(" Copy from '%s' to '%s' failed/n", file, str);	}	return err;}
开发者ID:linkedinyou,项目名称:blender-git,代码行数:29,


示例5: copyFiles

 size_t copyFiles(std::wstring sourcepath, std::wstring destpath, std::wstring mask, bool case_sensitive, bool rec, bool overwrite)     {     #if defined (_MSC_VER)     int copied = 0;     if ((sourcepath.length() != 0) && (sourcepath[sourcepath.length() - 1] != L'//'))  { sourcepath += L"//"; }     if ((destpath.length() != 0) && (destpath[destpath.length() - 1] != L'//'))        { destpath += L"//"; }     std::vector<std::wstring> tabsource;     if (getFileList(sourcepath, mask, case_sensitive, tabsource, rec, true, rec) == false) { return(-1); }     for (std::vector<std::wstring>::iterator it = tabsource.begin(); it != tabsource.end(); it++)         {         if ((it->length() != 0) && ((*it)[it->length() - 1] == L'//'))             {             if (CreateDirectoryW((destpath + (*it)).c_str(), NULL) == 0) { if (GetLastError() != ERROR_ALREADY_EXISTS) { return -1; } }             }         else             {             bool fie = false; if (overwrite == false) { fie = true; }             if (CopyFileW((sourcepath + (*it)).c_str(), (destpath + (*it)).c_str(), fie) == 0) { return -1; }             }         copied++;         }     return copied;     #else     // TODO     #endif     return -1;     }
开发者ID:vindar,项目名称:mtools,代码行数:27,


示例6: SetFileAttributesW

DWORD FFileManagerWindows::InternalCopy( const TCHAR* DestFile, const TCHAR* SrcFile, UBOOL ReplaceExisting, UBOOL EvenIfReadOnly, UBOOL Attributes, FCopyProgress* Progress ){	if( EvenIfReadOnly )	{		SetFileAttributesW(DestFile, 0);	}	DWORD Result;	if( Progress )	{		Result = FFileManagerGeneric::Copy( DestFile, SrcFile, ReplaceExisting, EvenIfReadOnly, Attributes, Progress );	}	else	{		MakeDirectory(*FFilename(DestFile).GetPath(), TRUE);		if( CopyFileW(SrcFile, DestFile, !ReplaceExisting) != 0)		{			Result = COPY_OK;		}		else		{			Result = COPY_MiscFail;		}	}	if( Result==COPY_OK && !Attributes )	{		SetFileAttributesW(DestFile, 0);	}	return Result;}
开发者ID:LiuKeHua,项目名称:colorful-engine,代码行数:29,


示例7: copy_file

static HRESULT copy_file( const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_dir, DWORD dst_len,                          const WCHAR *filename ){    WCHAR *src_file, *dst_file;    DWORD len = strlenW( filename );    HRESULT hr = S_OK;    if (!(src_file = HeapAlloc( GetProcessHeap(), 0, (src_len + len + 1) * sizeof(WCHAR) )))        return E_OUTOFMEMORY;    memcpy( src_file, src_dir, src_len * sizeof(WCHAR) );    strcpyW( src_file + src_len, filename );    if (!(dst_file = HeapAlloc( GetProcessHeap(), 0, (dst_len + len + 1) * sizeof(WCHAR) )))    {        HeapFree( GetProcessHeap(), 0, src_file );        return E_OUTOFMEMORY;    }    memcpy( dst_file, dst_dir, dst_len * sizeof(WCHAR) );    strcpyW( dst_file + dst_len, filename );    if (!CopyFileW( src_file, dst_file, FALSE )) hr = HRESULT_FROM_WIN32( GetLastError() );    HeapFree( GetProcessHeap(), 0, src_file );    HeapFree( GetProcessHeap(), 0, dst_file );    return hr;}
开发者ID:GYGit,项目名称:reactos,代码行数:25,


示例8: DownloadBSC_OnStopBinding

static HRESULT WINAPI DownloadBSC_OnStopBinding(IBindStatusCallback *iface,        HRESULT hresult, LPCWSTR szError){    DownloadBSC *This = impl_from_IBindStatusCallback(iface);    TRACE("(%p)->(%08x %s)/n", This, hresult, debugstr_w(szError));    if(This->file_name) {        if(This->cache_file) {            BOOL b;            b = CopyFileW(This->cache_file, This->file_name, FALSE);            if(!b)                FIXME("CopyFile failed: %u/n", GetLastError());        }else {            FIXME("No cache file/n");        }    }    if(This->callback)        IBindStatusCallback_OnStopBinding(This->callback, hresult, szError);    if(This->binding) {        IBinding_Release(This->binding);        This->binding = NULL;    }    return S_OK;}
开发者ID:bpowers,项目名称:wine,代码行数:29,


示例9: copy_user_manual

/* Copy manual from install dir to Seafile directory */voidcopy_user_manual (){    char *installdir;            /* C:/Program Files/Seafile */    char *seafdir;              /* C:/Seafile */    char *src_path;             /* C:/Program Files/Seafile/help.txt */    char *dst_path;             /* C:/Seafile/help.txt */    wchar_t *src_path_w, *dst_path_w;    installdir = g_path_get_dirname (seafile_bin_dir);    seafdir = g_path_get_dirname (applet->seafile_dir);    src_path = g_build_filename (installdir, _("Seafile help.txt"), NULL);    dst_path = g_build_filename (seafdir, _("Seafile help.txt"), NULL);    src_path_w = wchar_from_utf8 (src_path);    dst_path_w = wchar_from_utf8 (dst_path);    BOOL failIfExist = FALSE;    CopyFileW (src_path_w, dst_path_w, failIfExist);    g_free (installdir);    g_free (seafdir);    g_free (src_path);    g_free (dst_path);    g_free (src_path_w);    g_free (dst_path_w);}
开发者ID:Jack-Tsue,项目名称:seafile,代码行数:30,


示例10: downloadcb_OnStopBinding

static HRESULT WINAPI downloadcb_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError){    struct downloadcb *This = impl_from_IBindStatusCallback(iface);    TRACE("(%p)->(%08x %s)/n", This, hresult, debugstr_w(szError));    if (FAILED(hresult))    {        This->hr = hresult;        goto done;    }    if (!This->cache_file)    {        This->hr = E_FAIL;        goto done;    }    if (CopyFileW(This->cache_file, This->file_name, FALSE))        This->hr = S_OK;    else    {        ERR("CopyFile failed: %u/n", GetLastError());        This->hr = E_FAIL;    }done:    SetEvent(This->event_done);    return S_OK;}
开发者ID:Moteesh,项目名称:reactos,代码行数:30,


示例11: SetupDecompressOrCopyFileW

/*********************************************************************** *      SetupDecompressOrCopyFileW  ([email
C++ CopyFrom函数代码示例
C++ CopyFileA函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。