操作系统 windows10 编译环境 visual studio 2022 EASYX版本 2023大暑版
在清屏之后,程序有时候会突然崩溃,有的时候就可以正常运行。
返回值是 -1073741819,调试调用堆栈发现是ntdll.RtlpWaitOnCriticalSection()函数出了问题,但是没有指明具体哪一个变量有问题
#include <graphics.h>
#include <conio.h>
#include <iostream>
using namespace std;
void show()
{
const int width = 640;
const int length = 320;
initgraph(width, length, EX_SHOWCONSOLE | EX_NOCLOSE); // 设置图形窗口大小
_getch();
closegraph();
}
int main() {
// 初始化图形界面
printf("hello"); // 控制台窗口显示hello
show();
system("cls"); // 清屏
_getch();
return 0;
}