【发布时间】:2017-07-28 21:51:04
【问题描述】:
尝试使用WriteConsoleOutputCharacter 函数时,应用程序崩溃。
COORD pos;
pos.X = 0;
pos.Y = 0;
HANDLE buffer = GetStdHandle(STD_OUTPUT_HANDLE);
LPDWORD written;
char* str = "s";
WriteConsoleOutputCharacter(buffer, str, strlen(str), pos, written);
但是 WriteConsole 函数可以正常工作:
WriteConsole(buffer1,str,strlen(str),written,NULL);
我没有收到任何错误,但 Windows“应用程序停止响应”通知,我无法使用调试器,因为我使用的 IDE (Dev C++ 5.11) 有一个损坏的。
【问题讨论】:
-
LPDWORD written- 当然是崩溃。你需要使用DWORD written和WriteConsoleOutputCharacter(buffer, str, strlen(str), pos, &written);
标签: c++ windows winapi output console-application