我必须用 C++ 编写 CreateFile 函数 我写了这个,但它没有用
#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
int main()
{
HANDLE hfile = CreateFile(
".\temp.txt", // "\\.\C:"
GENERIC_READ,
0,
NULL,
CREATE_NEW,
FILE_ATTRIBUTE_NORMAL,
NULL);
//if (hFile == INVALID_HANDLE_VALUE) cout << "Unable to create file \n";
return 0;
}
错误 C2664:“CreateFileW”:无法将参数 1 从“const char [10]”转换为“LPCWSTR”
我该如何解决这个错误?