类型“ wchar_t *”的参数与类型“ LPCSTR”的参数不兼容

时间:2019-12-22 14:11:43

标签: c++ winapi

因此将其放到Visual Studio 2019中似乎给了这个错误。我查了一下,并被告知将字符集更改为UNICODE,但仍然存在相同的问题。帮助吗?

wchar_t* screen = new wchar_t[nScreenWidth * nScreenHeight];
HANDLE hConsole = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
SetConsoleActiveScreenBuffer(hConsole);
DWORD dwBytesWritten = 0;

screen[nScreenWidth * nScreenHeight - 1] = '\0';
WriteConsoleOutputCharacter(hConsole, screen, nScreenWidth * nScreenHeight, { 0,0 }, &dwBytesWritten);

0 个答案:

没有答案