我在使用GNU GCC编译器和Windows 7使用Code :: Blocks来使CopyFile()函数工作时遇到了一些麻烦 无论我在哪里放置文件,即Root,Public Documents,包含.cpp程序的foulder我都无法复制简单的文本文件。它总是返回错误代码2 error_file_not_found
#include <iostream>
#include <fstream> //allows files to be streamed into this program
#include <windows.h> // included for copying a file
#include <tchar.h> // included because I am grasping at straws
#include <stdio.h> // included because I am grasping at straws
#include <cstdlib> // included because I am grasping at straws
using namespace std;
int main(){
bool b = CopyFile("C:\\test.txt","C:\\test2.txt",0);
if (!b) {
cout << "Error: " << GetLastError() << endl;
} else {
cout << "Okay " << endl;
}
return 0;
}
有什么建议吗?