#include <iostream> using namespace std; #include <windows.h> #include <AtlBase.h> #include <AtlConv.h> int main() { const char from[100] = "F:\\桌面\\test\\新建文本文档.txt"; char to[100] = "D:\\test.txt"; USES_CONVERSION; LPCWSTR pFrom = A2CW(from); LPCWSTR pTo = A2CW(to); CopyFile(pFrom, pTo, 1); return 0; }
该程序调用windows API实现文件拷贝