1.复制文件
BOOL WINAPI CopyFile( __in LPCTSTR lpExistingFileName, __in LPCTSTR lpNewFileName, __in BOOL bFailIfExists );
2.移动文件
BOOL WINAPI MoveFile( __in LPCTSTR lpExistingFileName, __in LPCTSTR lpNewFileName );
BOOL WINAPI DeleteFile( __in LPCTSTR lpFileName );
Test
#include <windows.h> #include <stdio.h> #include <iostream> int main() { std::wstring originalStrFile(L"d:\\test.txt"); std::wstring newStrFile(L"d:\\test2.txt"); std::wstring newStrFileDir(L"e:\\test.txt"); CopyFile(originalStrFile.c_str(),newStrFile.c_str(),true); MoveFile(originalStrFile.c_str(),newStrFileDir.c_str()); DeleteFile(originalStrFile.c_str()); }