我必须在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;
}
Run Code Online (Sandbox Code Playgroud)
错误C2664:'CreateFileW':无法将参数1从'const char [10]'转换为'LPCWSTR'
我该如何解决这个错误?