CopyFile函数定义在Windows.h中,使用时要include之;
CopyFile()使用如下:
#include <Windows.h>
int main()
{
CopyFile("C:\\a.txt", "C:\\b.txt", FALSE);
}
便可将a.txt文件复制到b.txt文件,第三个参数表示:如果目标已经存在,不拷贝(True)并返回False,覆盖目标(false);
若文件路径为string类型变量,例如为pathstr,则需使用pathstr.c_str()转换即可;